
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Notes; Professor: Vaz; Class: Modern Differential Equations; Subject: Mathematics; University: Arizona State University - Tempe; Term: Unknown 1989;
Typology: Study notes
1 / 1
This page cannot be seen from the preview
Don't miss anything!

Script M-Files
Generally, MATLAB requires the use of several commands to produce a complicated
graphic. Improving these graphics need repeated use of a large number of commands. To
get around this, we enter the commands into a text file (called M-files ), and execute them
with one command. M-files used to create complicated graphics are called script M-files.
Example : Plot the solutions to the differential equation y ′=^ x + 2 with initial conditions
y ( 0 )=− 2 ,− 1 , 0 , 1 , 2 over the interval^ − 2 ≤ x ≤ 2
The general solution to the differential equation is x C
x y x = + 2 + 2
2
. The initial
condition y ( 0 )= C. We create a script file as follows:
(' to / 2 .')
2
2
2
2
2
legend y y y y y
title Solutions dy dx x
ylabel y
xlabel t
gridon
x C
x C ; plot(x,
x C
x C ; plot(x,
x C
x C ; plot(x,
x C
x C -; plot(x,
hold on
x C
x C -; plot(x,
x ;
AcroPDF - A Quality PDF Writer and PDF Converter to create PDF files. To remove the line, buy a license.