Velocidad.mpdf

Embed Size (px)

DESCRIPTION

MATLAB

Citation preview

  • 30/11/15 1:05 C:\Users\usuario\Desktop\Documents\3 AO\Matem...\velocidad.m 1 of 1

    ymax=100;tmax=100;suby=100;subt=100;D=0.05; %es la viscosidad.deltay=ymax/suby;deltat=tmax/subt;r=D*deltat/((deltay)^2);y=0:deltay:ymax;t=0:deltat:tmax;V=zeros(length(y),length(t)); %matriz para guardar datos.V(1,:)=5; %condicin de borde de la velocidad.V(end,:)=0; %condicin de borde del tiempo.for i=2:length(y)-1 for j=2:length(t)-1 V(i,j+1)=V(i,j)*(1-2*r)+r+(V(i+1,j)+V(i-1,j)); end err=norm(V(:,j)-V(:,j-1),inf)/norm(V(:,j)+eps,inf); tol=0.01; if err