Question: In this computer lab, we shall learn how to use MATLAB to obtain numerical solutions ( approximate solutions found through algorithms ) of 1 st
In this computer lab, we shall learn how to use MATLAB to obtain numerical solutions approximate solutions found through algorithms of storder equations of the form
stORDER EQUATIONS.
MATLAB has several numerical procedures for computing the solutions of firstorder equations and systems of the form ; we shall concentrate on "ode which is a soupedup RungeKutta method. The first step is to enter the equation by creating an Mfile" which contains the definition of your equation, and is given a name for reference, such as "diffeqn" the suffix will be added to identify it as an Mfile. The second step is to apply ode by using the syntax:
where is the initial time, is the final time, and is the initial condition, The same syntax works for equations and systems alike.
Example for
Creating the Mfile. Start up MATLAB; the Command Window appears with the prompt awaiting instructions. Choose New from the File menu and select Mfile. You are now in a text editor where you create MATLAB files. Enter the following text:
function example
;
Name this Mfile "examplem by selecting Save As from the File menu. Note: The semicolon at the end tells MATLAB to suppress displaying output. If you leave out the semicolon and run ode MATLAB will display a lot of calculations that you don't need to see.
Running ode Return to the Command Window, and enter the following:
ode;
The tells MATLAB to consider and the last tells it to start at When you hit the enter key, MATLAB will do its computing, then give you another promnt
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
