{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

4_pdfsam_3

4_pdfsam_3 - Problem solve for s s 2 5 s 6 = 0 s = − b ±...

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

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 file : Saves all text from the Matlab session, except for the prompts ( >> ), as text in file , written to the present working directory. If file is not specified, the information is written to the file 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.
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

{[ snackBarMessage ]}

What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern