Homework 22 Solution

Homework 22 Solution - Lecture 22 MEEN 357 Homework...

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

View Full Document Right Arrow Icon
Lecture 22 MEEN 357 Homework Solution 1 Lecture-22-Homework-Solution.doc RMB 1. You are given the ordinary differential equation 2 32 23 0 du u dt dt dt ⎛⎞ + ++ = ⎜⎟ ⎝⎠ (22.1) Utilize MatLab to solve this ordinary differential equation in the interval 51 2 t subject to the initial conditions () ( ) 2 2 55 , 0 a n d 0 du d u u dt dt = == Solution: As usual, you must write (22.1) in normal form. By now, you should be able to see that it is 2 22 3 2 1 2 3 2 du du dt dt x dd u d u x dt dt dt x xx u dt dt dt ⎡⎤ ⎢⎥ = −− ⎣⎦ x (22.2) The function mfile that defines this ordinary differential equation is called P1.m and contains the script function dxdt=P1(t,x) dxdt =[x(2);x(3);-2*x(3)-x(2)^2-3*x(1)]; The script clc clear all x0=[1,0,0] tspan=[5,12]; [t,x]=ode45 (@P1,tspan,x0) plot(t,x(:,1), 'r' , 'linewidth' ,2) hold on plot(t,x(:,2), 'g' , 'linewidth' ,2) grid on xlabel( 't' );ylabel( 'u(x)and du(x)/dt' ); legend( 'u(x)' , 'du(x)/dt' ) title({ 'Lecture 22 Problem 1' }) Produces the figure
Background image of page 1

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

View Full DocumentRight Arrow Icon
Lecture 22 MEEN 357 Homework Solution 2 Lecture-22-Homework-Solution.doc
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 07/28/2010 for the course MEEN 357 taught by Professor Anamalai during the Fall '07 term at Texas A&M.

Page1 / 4

Homework 22 Solution - Lecture 22 MEEN 357 Homework...

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

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