A function u(x,t) satises a PDE. When we choose x = .05 and t = .01 the followin
ID: 3184931 • Letter: A
Question
A function u(x,t) satises a PDE. When we choose x = .05 and t = .01 the following dierence equation is obtained, ui,j+1 = (.5)ui+1,j + (.5)ui1,j The PDE is to be solved over the region 1 x 2 with 0 t 0.5, it is known that u(x,t) satises the following conditions, u(1,t) = 0, u(2,t) = 1, u(x,0) = (x1) Determine the value of u(1.5,0.2) =?
syms z
lower(z) = (z-1);
dx = .05;
dt = .01;
for c = 1:21
M(1,c) = lower(1+ (c-1)*dx);
end
for r = 1:51
M(r,1) = 0;
end
for r = 1:51
M(r,21) = 1;
end
for r = 2:51
for c = 2:20
M(r,c) = (.5)*M(r-1,c-1) + (.5)*M(r-1,c+1);
end
end
I have the code for the problem, but I dont understand how to find the value of u(1.5,0.2)
Explanation / Answer
you have the right code for the above problem.
All the three for loops are correct. You have taken x as column and t as rows
and if you have to find any value u(x1,t1) then you should find first the index value for x1 and t1
if you get those indices then you will be able to find the value.
For example in this question we are finding value of u(1.5, .2)
so first find the position of 1.5 in the matrix format of U then find position of .2 in
For that step size dx and dt will help
dx=.05
so position of 1.5 is ((1.5-1)/.05)+1
=11
and dt=0.01
so position of .2 = ((.2-0)/.01)+1
=21
and you have taken reverse of the given qsn ie. x as column and t as rows so basically you have to find
M(21,11) in the given code
Solved.......
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.