Anyone can help me for the Code finite difference method (backward difference)?
Info
This question is closed. Reopen it to edit or answer.
Show older comments

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)
Answers (0)
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!