This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Math245 Computer Lab set #3, Spring 2009 Inline funtion Suppose now we have a function that we are interesting in how it looks like, for example, y = exp ( x/ 5) cos ( x 2 ) 1 (1) Step one create a handle called f to represent this function, i.e., f = @( x ) exp ( x/ 5) * cos ( x 2 ) 1 (2) Step two use function ezplot to get a quick look, ezplot ( f, , 8) (3) 1 2 3 4 5 6 7 81.81.61.41.210.80.60.40.2 x exp(x/5) cos(x 2 ) 1 In step one, the handles name f is free to be changed to anything you like, but the format = @( x ) has to be there. In other words, if it is a function of two variables, the format should be = @( x,y ) in the case that the two variables are x and y . Notice that in describing the function, there is no need to use elementbyelement operators, i.e., ( . * ,etc. ) Also notice that the handle f is stored as a variable therefore a clear command will remove this handle. Solve the 1st order ODE by using Matlab We consider the 1st order ODE in the form dy dt = f ( t,y ) , with initial condition y (0) = y . To obtain the numerical solution to this initial value problem, we will....
View
Full
Document
This note was uploaded on 06/01/2009 for the course MATH 245 taught by Professor Alexander during the Spring '07 term at USC.
 Spring '07
 Alexander
 Math

Click to edit the document details