Question

Problem 1 (Section 6.3) Starting with the finite difference expressions for the partial derivatives, re-derive the forward Eu

0 0
Add a comment Improve this question Transcribed image text
Answer #1

% Code in Matlab

clc;
clear all;

L=1;
N=5;
k=1;
gamma=2;
del_t=0.01;
del_x=L/N;
alpha=k*del_t/del_x.^2;

for j=1:4
u(1,j)=0;
u(6,j)=0;
u(1,1)=0;
u(2,1)=1;
u(3,1)=2;
u(4,1)=2;
u(5,1)=1;
u(6,1)=0;
for i=2:N-1

u(i,j+1)=u(i,j)+alpha*(u(i+1,j)-2*u(i,j)+u(i-1,j))-gamma*u(i,j).^2;
end;
end;

%u(n=1,m=1)=u(2,2)=-1
%u(n=1,m=2)=u(2,3)=-4.0625
%u(n=1,m=3)=u(2,4)=-55.8047
%u(n=2,m=1)=u(3,2)=-6.25
%u(n=2,m=2)=u(3,3)=-83.0625
%u(n=2,m=3)=u(3,4)=-1.3862e4
%u(n=3,m=1)=u(4,2)=-6.25
%u(n=3,m=2)=u(4,3)=-82.8125
%u(n=3,m=3)=u(4,4)=-1.3778e4
%u(n=4,m=1)=u(5,2)=0
%u(n=4,m=2)=u(5,3)=0
%u(n=4,m=3)=u(5,4)=0

Add a comment
Know the answer?
Add Answer to:
Problem 1 (Section 6.3) Starting with the finite difference expressions for the partial derivatives, re-derive the forward Euler method for the heat equation with an extra nonlinear term: u(0,t)- u(1...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT