parenrightBigg e 1 75 t 7 3962 parenleftBigg 4472 8944 parenrightBigg e 125 t

# Parenrightbigg e 1 75 t 7 3962 parenleftbigg 4472

• 6

This preview shows page 3 - 5 out of 6 pages.

parenrightBigg e - 1 . 75 t + 7 . 3962 parenleftBigg 0 . 4472 0 . 8944 parenrightBigg e - 0 . 125 t + parenleftBigg 16 16 parenrightBigg . The MatLab’s numerical solver, ode23 , extends easily to systems of 1 st order differential equa- tions. Below we show how to both use the numerical solver and the exact solution above to graph the u ( t ). First the right hand side of System (1) is made into a MatLab function 1 function yp = greenhouse ( t , y ) 2 % Greenhouse DE ( rhs ) 3 yt1 = - (13/8) * y (1) +(3/4) * y (2) + 14; 4 yt2 = (1/4) * y (1) - (1/4) * y (2) ; 5 yp = [ yt1 , yt2 ] ’ ; 6 end The function plotting the numerical and exact solutions is given by 1 mytitle = ’ Greenhouse/Rockbed ’ ; % Title 2 xlab = ’ \$t\$ hrs ’ ; % X - l a b e l 3 ylab = ’ Temperature ( \$ˆ \ circ\$C ) ’ ; % Y - l a b e l 4 5 u0 = [ 5 , 2 5 ] ’ ; 6 [ t , u ] = ode23 ( @greenhouse , [ 0 , 1 0 ] , u0 ) ; % simulate heat with ode23 7 tt = linspa ce (0 ,10 ,200) ; 8 u1 = - 14.3077 * exp ( - 1.75 * tt ) +3.3077 * exp ( - 0.125 * tt ) +16; % so lutio n u1 9 u2 = 2.3846 * exp ( - 1.75 * tt ) +6.6154 * exp ( - 0.125 * tt ) +16; % so lutio n u2 10 11 plot ( t , u ( : , 1 ) , ’b - , ’ LineWidth ’ , 1 . 5 ) ; % Plot greenhouse a i r ( numeric ) 12 hold on % Plots Multiple graphs 13 plot ( t , u ( : , 2 ) , ’ r - , ’ LineWidth ’ , 1 . 5 ) ; % Plot greenhouse rocks ( numeric ) 14 plot ( tt , u1 , ’ c : ’ , ’ LineWidth ’ , 1 . 5 ) ; % Plot greenhouse air , u1 15 plot ( tt , u2 , ’m: ’ , ’ LineWidth ’ , 1 . 5 ) ; % Plot greenhouse rocks , u2 16 plot ( [ 0 1 0 ] , [ 1 6 1 6 ] , ’k : ’ , ’ LineWidth ’ , 1 . 5 ) ; % Plot equilibrium 17 grid % Adds Gr idlines 18 text (0 .6 ,1 1 , ’ \$u 1\$ ’ , ’ co lo r ’ , ’ blue ’ , ’ FontSize ’ , 1 4 , . . .

Subscribe to view the full document.

19 ’FontName ’ , ’ Times New Roman ’ , ’ i n t e r p r e t e r ’ , ’ la tex ’ ) ; 20 text (3 ,22 , ’ \$u 2\$ ’ , ’ co lo r ’ , ’ red ’ , ’ FontSize ’ , 1 4 , . . . 21 ’FontName ’ , ’ Times New Roman ’ , ’ i n t e r p r e t e r ’ , ’ la tex ’ ) ; 22 legend ( ’ Air ( numeric ) ’ , ’ Rockbed ( numeric ) ’ , ’ Air ( exact ) ’ , . . . 23 ’ Rockbed ( exact ) ’ ,4) ; 24 25 a xis ( [ 0 10 0 3 0 ]) ; % Defines l i m i t s of graph 0 1 2 3 4 5 6 7 8 9 10 0 5 10 15 20 25 30 u 1 u 2 t hrs Temperature ( C) Greenhouse/Rockbed Air (numeric) Rockbed (numeric) Air (exact) Rockbed (exact) The graph shows how well the numerical routine ode23 in MatLab tracks the solution to System (1). As we saw in the lecture notes, the heat transfers rapidly into the air compartment, then slowly the solution tends toward the equilibrium solution. Phase Portrait - 2D This final section shows how to create two dimensional phase portraits and direction fields . You begin by downloading the MatLab files for pplane and dfield by John Polking from Rice University. The current version is pplane8 , which is invoked by having this m-file in your current directory and typing pplane8 in the command window of MatLab.
• Fall '08
• staff

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern