How to solve this question in MATLAB?
Show older comments
I have tried this question manually as well as in MATLAB but the value of U(x,t) not match with my manual calculation answer. I dont know where I make the mistake.
%Evaluate BC
dx = 0.25;
X = 0:dx:1;
dt = 0.1;
t = 0:dt:1;
h = 1/(length(X)-1) ; %step size
u = zeros(length(t),length(X));
for j = 1:length(t)
for i=1:length(X)
u(j,i) = exp((-pi*j)/4)*sin((pi*i)/2);
end
end
disp([X' u'])

1 Comment
Jiri Hajek
on 11 Jan 2023
Hi, in your expression, you are not using as inputs x(i) and t(j), but just the indices...
Accepted Answer
More Answers (0)
Categories
Find more on File Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
