SHARE
TWEET

u_t=u_xxxxxx

a guest Sep 24th, 2014 279 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. a = 0
  2. b = 1
  3. T = 0.01
  4. spaceStep = 0.1
  5. timeStep = spaceStep^6/50
  6. nT = T/timeStep
  7. nS = (b-a)/spaceStep + 1
  8. u = exp(-([1:nS]*spaceStep).^2)
  9. for i = 1 : nT
  10.     v = [u(4),u(3),u(2),u,u(nS-1),u(nS-2),u(nS-3)]
  11.     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)
  12.     u = u + timeStep/(spaceStep)^6*w
  13.     if (modulo(i,10000)==0) then
  14.         plot(a:spaceStep:b,u)
  15.     end
  16. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top