Attribution Non-Commercial (BY-NC)

65 views

Attribution Non-Commercial (BY-NC)

- Control System Analysis Design in MATLAB and SIMULINK
- Nasao Training Course 2011
- Propeller
- Matlab 14
- ENES101 Fall2015 Rev 3
- Science Odd Sem 2019 Routine Revised
- Open Source Softwares List
- matlab-b
- Matlab Basics
- Introductory Methods Of Numerical Analysis_S. S. Sastry (1).pdf
- Math 311 Numerical Solutions of Ordinary Differential Equations.doc
- MATLAB-licensing.pdf
- Readme
- PlotXY
- Proj1 IEEE
- 10.1.1.31.4358
- Algorithms 09 00014
- oleson instructions project matlab
- Progres Kelompok 3
- 3015 Discussion 4 Solutions

You are on page 1of 2

This routine uses a variable step Runge-Kutta Method to solve differential equations numerically.

The syntax for ode45 for first order differential equations and that for second order differential

equations are basically the same. However, the .m files are quite different.

(

y 0 = f (t, y)

I. First Order Equations y(t0 ) = y0

A. Create a .m file for f (t, y) (see the tutorial on numerical methods and m files on how to

do this). Save file as, for example, yp.m .

B. Basic syntax for ode45 . At a Matlab prompt type :

[t,y]=ode45(’yp’,[t0,tf],y0);

(your version of ode45 may not require brackets around t0, tf)

yp = the .m file of the function f (t, y) saved as yp.m

t0, tf = initial and terminal values of t

y0 = initial value of y at t0

(

t2 y 0 = y + 3t

C. For example, to numerically solve over the interval 1 ≤ t ≤ 4 :

y(1) = −2

1

• Create and save the file yp.m for the function (y + 3t).

t2

• At a Matlab prompt type:

[t,y]=ode45(’yp’,[1,4],-2);

(your version of ode45 may not require backets around [1,4])

• To plot results type : plot(t,y)

• To plot results type with a ’+’ symbol : plot(t,y,’+’)

00 0

y + p(t) y + q(t) y = g(t)

II. Second Order Equations

y(t0 ) = y0

y 0 (t0 ) = y1

A. First convert 2nd order equation above to an equivalent system of 1st order equations.

Let x1 = y, x2 = y 0 :

(

x01 = x2

, where x1 (t0 ) = y0 , x2 (t0 ) = y1 .

x02 = −q(t) x1 − p(t) x2 + g(t)

B. Create and save a .m file which will return a vector-valued function. This is a little tricky

so here is a specific example. Suppose the system is as below and 0 ≤ t ≤ 4

(

x01 = x2

, where x1 (0) = 2, x2 (0) = 8 .

x02 = −t x1 + et x2 + 3 sin 2t

• Create the following function file and save it as F.m :

function xp=F(t,x)

xp=zeros(2,1); % since output must be a column vector

xp(1)=x(2);

xp(2)=-t*x(1)+exp(t)*x(2)+3*sin(2*t); % don’t forget ; after each line

[t,x]=ode45(’F’,[t0,tf],[x10,x20]);

F= the .m file of the vector-function saved as above

t0, tf = initial and terminal values of t

x10 = initial value of x1 at t0 : x10 = x1 (t0 )

x20 = initial value of x2 at t0 : x20 = x2 (t0 )

The example above becomes :[t,x]=ode45(’F’,[0,4],[2,8]);

• Since x1 (t) = y, to print out the values of the solution y for t0 ≤ t ≤ tf , type :

[t,x(:,1)]

(This is because the vector x has 1st component x1 = y and 2nd component x2 = y 0 .)

• To plot x1 vs x2 (phase plane) type : plot(x(:,1),x(:,2))

- Control System Analysis Design in MATLAB and SIMULINKUploaded byXimenyPoka
- Nasao Training Course 2011Uploaded byOnyiuke Ikechukwu
- PropellerUploaded byPavan Kishore
- Matlab 14Uploaded byadnan
- ENES101 Fall2015 Rev 3Uploaded byAlex Doan
- Science Odd Sem 2019 Routine RevisedUploaded byDivya Sinha
- Open Source Softwares ListUploaded bytommy900
- matlab-bUploaded byMannath Sungar
- Matlab BasicsUploaded bydashmon
- Introductory Methods Of Numerical Analysis_S. S. Sastry (1).pdfUploaded byrahul singh
- Math 311 Numerical Solutions of Ordinary Differential Equations.docUploaded bymartinariel79
- MATLAB-licensing.pdfUploaded byManish Vankudre
- ReadmeUploaded byRicardo Trejo
- PlotXYUploaded byumairnaeem_90
- Proj1 IEEEUploaded byefanie
- 10.1.1.31.4358Uploaded byMaiman Lato
- Algorithms 09 00014Uploaded byCuplis Ae
- oleson instructions project matlabUploaded byapi-273162418
- Progres Kelompok 3Uploaded byRadianSitumeang
- 3015 Discussion 4 SolutionsUploaded bykmgrandell
- Dsp Lab FinalUploaded byAnonymous V7P5fNQI
- Matrix Sheet1 4Uploaded byCartoonn Aroonnumchok
- mcforthesis.pdfUploaded byafegao2
- asdfUploaded byAnonymous 8Q8RKr9
- Review of Sumation by Part Schemes for Initial Boundary Value ProblemUploaded byĐặng Sơn Tùng
- Matrices and Arrays - MATLAB & Simulink.pdfUploaded byMakhdoom Ibad Hashmi
- matlab a exeUploaded bycrustycore
- Metodos de Interpolacion 2 DIAS PARA TRABAJARUploaded byRaquel Rivera Tupacyupanqui
- EE520-HW2-171sUploaded bykhalid
- platerecognition-matlab.txtUploaded byRa'ad Elias Shomaly

- Alspa Boiler Care Amodis HrsgUploaded byArya Aryan
- Quantitative Technique IIUploaded byArvind Yadav
- Serck Services CatalogueUploaded byMorgan Palma
- MIC CorrosionUploaded bysuperdick14
- 07515213Uploaded byjack_clift
- Circuits 1_Delta to Wye.pptUploaded byAnthony Cortez
- Parker (PAVC33 PAVC38) Hydraulic Piston Pumps Service Literature Service PartsUploaded byAnonymous gKfTqXObkD
- Solutions JehleUploaded byLaila
- CAN BUS.pptUploaded byplugas
- 907.full.pdfUploaded bySyalara Fatharani
- RATES OF REACTION- Anson G..pptxUploaded byAnson G.
- Type Certificate Data Sheet No. 1E4Uploaded byflyingemu
- 80 Percent of Quranic WordsUploaded byislamicthinker
- The Memory and Input/Output InterfacesUploaded byCalvin Ohsey
- mca syllabusUploaded bytejachandra
- Introduction to Object-Oriented ProgrammingUploaded byTendai Mare
- A Presentation on Microcontroller 8051Uploaded byPraveen Shrivastava
- irf7329pbf-936101.pdfUploaded byKrista Tran
- Electromagnetic Transient in Power System and Insulation Coordination StudiesUploaded bybubo28
- 4140 Final Exam Fa16Uploaded byAdam
- Vba Tool for SpcUploaded bysushmax
- 1202.1680Uploaded byNanang Dwi Ardi
- Nonleaching Antimicrobial Cotton Fibers for Hyaluronic Acid AdsorptionUploaded byJohnSmith
- Lesson18 Pulmonary SystemUploaded byGemma Wrigley
- Chapter 09Uploaded bySanjana Kiran
- TSP126 Condor Premier Technical Manual V2.2Uploaded byJeisson Franco Mejia
- Application of AISC Design Provisions for Tapered MembersUploaded byCarlos López Vega
- Magic MagnetUploaded byavula_sreenivas
- 23552714_ Laparoscopic vs Open Incisional Hernia Repair_ a Randomized Clinical TrialUploaded byELRC08
- Boring Bar ManualUploaded byPranjal Chakraborty