Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a = 0
- b = 1
- T = 0.01
- spaceStep = 0.1
- timeStep = spaceStep^6/50
- nT = T/timeStep
- nS = (b-a)/spaceStep + 1
- u = exp(-([1:nS]*spaceStep).^2)
- for i = 1 : nT
- v = [u(4),u(3),u(2),u,u(nS-1),u(nS-2),u(nS-3)]
- w = v(7:nS+6)-6*v(6:nS+5)+15*v(5:nS+4)-20*v(4:nS+3)+15*v(3:nS+2)-6*v(2:nS+1)+v(1:nS)
- u = u + timeStep/(spaceStep)^6*w
- if (modulo(i,10000)==0) then
- plot(a:spaceStep:b,u)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement