4_pdfsam_3 - Problem solve for s s 2 5 s 6 = 0 s = − b ± √ b 2 − 4 ac 2 a Matlab session>> diary roots>> a=1>> b=5>>

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
3.2.1 Diary Command The diary commands allows you to record all of the input and displayed output from a Matlab interactive workspace session. The commands include: diary fle : Saves all text from the Matlab session, except for the prompts ( >> ), as text in fle , written to the present working directory. If fle is not speciFed, the information is written to the Fle named diary . diary off : Suspends diary operation. diary on : Turns diary operation back on. diary : Toggles diary state Example 3.1 Use oF diary command Consider again the example involving roots of the quadratic equation.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Problem: solve for s: s 2 + 5 s + 6 = 0 s = − b ± √ b 2 − 4 ac 2 a Matlab session: >> diary roots >> a=1; >> b=5; >> c=6; >> x = -b/(2*a); >> y = sqrt(b^2-4*a*c)/(2*a); >> s1 = x+y s1 =-2 >> s2 = x-y s2 =-3 The Fle roots is written in your current working directory. It can be displayed by the Matlab command type roots . It can also be displayed in a Unix terminal window by the command more roots or printed with the command lp roots . a=1; b=5; 40...
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 東京国際大学.

Ask a homework question - tutors are online