This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: U_exact(1, i) = cos(pi*(x(1,i)-c*t)); end u(1,1)= u(1,Nb_Nodes-1); U_numerical = u; else for i = 1:(Nb_Nodes-1) u(1, i) = U_numerical(1,i) - c *(dt/dx)*(U_numerical(1, i+1) - U_numerical(1,i)); U_exact(1, i ) = cos(pi*(x(1,i)-c*t)); end u(1,Nb_Nodes-1)= u(1,1); U_numerical = u; end % pause(dt/10); clf; hold on ; axis( 'square' ); plot(x, U_numerical, 'bo' ); plot(x, U_exact, 'r' ); legend( 'Numerical' , 'Exact' ); pause(.01); end Kham Lee C = 1 C = -1...
View Full Document
This note was uploaded on 02/19/2012 for the course ENGR 361 taught by Professor Drexel during the Spring '12 term at Bloomsburg.
- Spring '12