This preview shows page 1. Sign up to view the full content.
Unformatted text preview: example1.m . M-±les are text ±les and may be created and modi±ed with any text editor. You need to know how to open, edit, and save a ±le with the text editor you are using. On a PC or Macintosh, an M-fle editor may be brought up by choosing New from the File menu in the Matlab Command window and selecting M-fle . The script M-±le is executed by choosing Run Script. .. from the File menu on a PC or Macintosh, or simply typing the name of the script ±le at the prompt in the Matlab command window. Example 3.2 Quadratic root fnding script Create the ±le named qroots.m in your present working directory using a text editor: % qroots: Quadratic root finding script format compact; a=1 b=5 c=6 x = -b/(2*a); y = sqrt(b^2-4*a*c)/(2*a); s1 = x+y s2 = x-y To execute the script M-±le, simply type the name of the script ±le qroots at the Matlab prompt: >> qroots a = 1 b = 5 c = 43...
View Full Document
This note was uploaded on 03/07/2010 for the course ENG 101 taught by Professor Chang during the Summer '09 term at 東京国際大学.
- Summer '09