eigA ans 23090 49965i 23090 49965i 19021 12842 vdeigA v Columns 1 through 3

Eiga ans 23090 49965i 23090 49965i 19021 12842 vdeiga

This preview shows page 2 - 4 out of 5 pages.

eig(A) ans = 2.3090 + 4.9965i 2.3090 - 4.9965i -1.9021 1.2842 [v,d]=eig(A) v = Columns 1 through 3 -0.1627 - 0.3412i -0.1627 + 0.3412i 0.4095 -0.3486 - 0.0541i -0.3486 + 0.0541i 0.7464 -0.7459 -0.7459 -0.1567 0.0000 - 0.4199i 0.0000 + 0.4199i -0.5006 Column 4 0.0735 0.9698 -0.1967 -0.1242 d = Columns 1 through 3 2.3090 + 4.9965i 0 0 0 2.3090 - 4.9965i 0 0 0 -1.9021 0 0 0 Column 4 0 0 0 1.2842 We note that all of the previous scripts were produced in MatLab and stored in a text file (test.txt). This is readily done by the MatLab commands: diary(’test.txt’) diary on MatLab entries here
Image of page 2

Subscribe to view the full document.

diary off The file test.txt will contain all the commands entered and the MatLab output in a text file, which can be easily read in any text editor. At this time we turn specifically to our murder problem. From the main lectures we saw that we needed to find the values for the heat coefficient, k , and the time of death, t d , which solved the equations 22 + 8 e - k = 28 and 22 + 8 e - kt d = 37 . The first equation is equivalent to finding the zero of f ( k ) = 22 + 8 e - k - 28 . MatLab has an easy way to enter an inline function, and the software has the special function fzero , which can be used to numerically find zeroes of a function. This special function fzero has the form fzero(f, x0) , where f is the function of some variable, and x 0 is an initial guess where the zero might be. The sequence of commands below begins with obtaining more digits, the it creates the necessary functions and solves them. format long f = @(k) 22+8*exp(-k)-28; k = fzero(f,0.3) k = 0.287682072451781 ft = @(t) 22+8*exp(-k*t)-37; td = fzero(ft,-5) td = -2.185081100344673 These values agree well with the ones found in the lecture notes. As pointed out in lecture, many differential equations cannot be solved exactly. MatLab has powerful routines for numerically solving a differential equation. Here we use the example from our murder problem: dT ( t ) dt = - k ( T ( t ) - T e ) , T (0) = 30 , (1) where t = 0 corresponds to 8:30 AM, T e = 22 C is the room temperature, and k is the heat coefficient found above using the body temperature at t = 1. Rather than working with line commands in the Command Window of MatLab, it is valuable to learn to create M-files for both functions and scripts. Before creating a new function or script file, it is a very good idea to point the Command Window to the directory where you are going to store your MatLab files. This is done in the window below greyed area for operations. We begin by creating a function, which is done by clicking on the New tab and selecting
Image of page 3
Image of page 4
  • Fall '08
  • staff

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes