Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Anyone can help me for the Code finite difference method (backward difference)?

1 vue (au cours des 30 derniers jours)
Eddy Iswardi
Eddy Iswardi le 7 Déc 2019
Clôturé : MATLAB Answer Bot le 20 Août 2021
this is finite difference scheme and limit values ​​and initial conditions. I've try to make the code, but I think something wrong with my code (and my algoritm). Please help me
clc;
clear all;
deltax=8;
v=997.15;
y=1;
Uinf=1;
t=100;
for k = 1:t
f(1,k) = 0;
f(k,t) = 0;
end
for g=1:t
u(1,g) = 1;
u(g,t) =1;
u(g+1,t)=0;
end
for g=t:-1:1
w(g,t) = (u(g+1,t)-u(g,t))/deltax;
w(1,g) = (u(2,g)-u(1,g))/deltax;
end
for j=t:-1:2
for i=1:(t-1)
f(i+1,j)=f(i-1,j-1)-deltax*u(i-1,j-1);
u(i+1,j)=u(i-1,j-1)-deltax*w(i-1,j-1);
w(i+1,j)=(1-(v^(1/2)*(y+2*t))/(2*t^(3/2)))*w(i-1,j-1)+((v*deltax)/(2*Uinf))*u(i-1,j-1);
end
end
u
plot(u)

Réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by