1st Order Time Dependent Example

1st Order Time Dependent Example - title('One Element...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
Further Analysis Using MATLAB % Example Time Stepping Scheme for 1st Order Problem % Example 6.2.1 Reddy Text - Third Edition clc;clear all;clf a=0;h=1; for dt=[0.675,0.6,0.5] for n=1:10 t(n)=(n-1)*dt; if n==1 u2(n)=1; continue end N=((h/3)-(1-a)*dt/h); D=((h/3)-a*dt/h); u2(n)=(N/D)*u2(n-1); end % Plotting Routine if dt==0.675 plot(t,u2,'o--k','linewidth',2) elseif dt==0.6 plot(t,u2,'+:k','linewidth',2) else plot(t,u2,'s-.k','linewidth',2) end hold on;grid on xlabel('Time, t');ylabel('Temperature, u(1,t)')
Background image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: title('One Element Analysis with \alpha = 0, Various Time Steps') end % Exact Solution for k=1:60 t(k)=k/10; W=0; for n=1:30 L=(2*n-1)*pi/2; W=W+(2/L)*exp(-L^2*t(k))*sin(L); end U(k)=W; end plot(t,U,'k-','linewidth',2) legend('0.675','0.600','0.500','Exact') 1 2 3 4 5 6 7-1.5-1-0.5 0.5 1 1.5 Time, t Temperature, u(1,t) One Element Analysis with = 0, Various Time Steps 0.675 0.600 0.500 Exact t critcal = 2/3 = 0.66667...
View Full Document

This note was uploaded on 10/03/2011 for the course MCE 561 taught by Professor Sadd during the Spring '11 term at Rhode Island.

Page1 / 5

1st Order Time Dependent Example - title('One Element...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online