solution13

# solution13 - Assignment 13 Prob 1...

This preview shows pages 1–4. Sign up to view the full content.

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

View Full Document
% Prob. 1 fp1=inline('x.*y'); [x,y]=ode45(fp1,0:0.2:1,1); disp(' x y') disp(' ') disp([x,y]) x y 0 1 0.2 1.0202 0.4 1.0833 0.6 1.1972 0.8 1.3771 1.6487 % Prob 2 [t,theta]=ode45('fp2',0:0.2:1,[pi/4,0]); disp(' t theta') disp(' ') disp([t,theta(:,1)]) t theta 0.7854 0.56671 0.022259 -0.53541 -0.7842 -0.59618 % Prob 3 [t,y]=ode45('fp3',0:0.2:1.6,[1,1]); % The exact solution is yexact=cos(5*t)+sin(t); disp(' t y yexact') disp(' ') disp([t,y(:,1),yexact]) yexact 0.73894 0.73897 -0.026918 -0.026728 -0.42532 -0.42535 0.063922 0.063712 1.1255 1.1251 1.2 1.8922 1.4 1.7389 1.7394 1.6 0.85351 0.85407 % Prob 4 % Since the equations are non-linear, there are multiple solutions: each % depend on the initial guess. % 1st solution options=optimset('display','off'); Z1=fsolve('fp4',[1,1],options) % 2nd solution Z2=fsolve('fp4',[-1,-1],options) disp(' ') Z1 = 3 Z2 = -3 -1

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 02/27/2010 for the course ENME 271 taught by Professor Marks during the Summer '08 term at Maryland.

### Page1 / 5

solution13 - Assignment 13 Prob 1...

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

View Full Document
Ask a homework question - tutors are online