You are on page 1of 5

Yael Fernando López Briones

8AV2

Dinámica de Fluidos Computacional

Ejercicio 1:
clear all
clc

A=0.3;
x0=2;y0=8; % comentar
x1=5;y1=4;

x=0:0.5:10;
y=0:0.5:10;
[X,Y]=meshgrid(x,y);

u=A.*X;
v=-A.*Y;
quiver(X,Y,u,v),hold on,axis([0 10 0 10]),grid on

c=x0*y0;
y=c./x;
c1=x1*y1;
y1=c1./x;
plot(x,y,'r',x,y1,"g"),hold on

for t=0:0.5:5;
x=x0*exp(A*t);
y=y0*exp(-A*t);
plot(x,y,"ko"),pause(1),title(sprintf("Tiempo = %f seg.",t))
end
Ejercicio 2:
clear all
clc

a=0.4;
b=2;
x0=2;y0=1;
x=0:0.5:10;
y=0:0.5:10;
[X,Y]=meshgrid(x,y);

%u=a*t;
%v=-b;
%quiver(X,Y,u,v),hold on,axis([0 10 0 10]),grid on

for t=0:5;
u=a*t;
v=b;

c=(a*t/b)*y0-x0; %al despejar c solo multiplica por y0


x=(a*t/b)*y-c;
subplot(1,2,1)
plot(x,y,'r'),hold on,grid on,axis('equal',[-1 11 -1
11]),pause(1),title(sprintf("Tiempo = %f",t))
%quiver(X,Y,u*0.2,v*0.2),grid on,axis("equal",[-1 11 -1
%11]),pause(1),title(sprintf("Tiempo = %f",t))
end

for t=0:0.5:5;
x=(a*t^2)/2+x0;
y=b*t+y0;
subplot(1,2,2)
plot(x,y,'ko'),grid on,axis('equal',[-1 11 -1 11]),hold
on,pause(1),title(sprintf("Tiempo = %f",t))
end

xs=2:0.1:10;
ys=b*((2*(xs-x0))/a).^0.5+y0;
subplot(1,2,2)
plot(xs,ys),hold on
Tarea 1 (Ejercicio 3) versión 1:
clear all
clc

a=0.5;
x0=1;y0=1;
x=0:0.5:10;
y=0:0.5:10;
[X,Y]=meshgrid(x,y);

for t=0:5;
u=x*(1+(a*t));
v=y;

c=y0-(x0^(1/(1+(a*t))));
y=x.^(1/(1+(a*t)))+c;
subplot(1,2,1)
plot(x,y,'r'),hold on,grid on,axis('equal',[-1 11 -1
11]),pause(1),title(sprintf("Tiempo = %f",t))
end

for t=0:0.5:5;
x=x0*(exp(t+(a/2*(t^2))));
y=y0*(exp(t));
subplot(1,2,2)
plot(x,y,'ko'),grid on,axis('equal',[-1 11 -1 11]),hold
on,pause(1),title(sprintf("Tiempo = %f",t))
end

ys=0:0.1:10;
xs=x0*(exp(log(y/y0)*(1+(a/2*log(y/y0)))));
subplot(1,2,2)
plot(xs,ys),hold on
Tarea 1 (Ejercicio 3) versión 2:
clear all
clc

a=0.5;
x0=1;y0=1;
x=0:0.5:10000;
y=0:0.5:10000;
[X,Y]=meshgrid(x,y);

for t=0:5;
u=x*(1+(a*t));
v=y;

c=y0-(x0^(1/(1+(a*t))));
y=x.^(1/(1+(a*t)))+c;
subplot(1,2,1)
plot(x,y,'r'),hold on,grid on,axis('equal',[-1 10001 -1
10001]),pause(1),title(sprintf("Tiempo = %f",t))
end

for t=0:0.5:5;
x=x0*(exp(t+(a/2*(t^2))));
y=y0*(exp(t));
subplot(1,2,2)
plot(x,y,'ko'),grid on,axis('equal',[-1 10001 -1 10001]),hold
on,pause(1),title(sprintf("Tiempo = %f",t))
end

ys=0:0.1:10000;
xs=x0*(exp(log(y/y0)*(1+(a/2*log(y/y0)))));
subplot(1,2,2)
plot(xs,ys),hold on

You might also like