AME 150L Lecture Notes - Lecture 19: Numerical Integration, Eval

39 views2 pages

Document Summary

Ame 150: introduction to computational methods - lecture #19: function functions function functions: functions that use names of other functions in the input argument list. Ex: predefined matlab function fzero fzero(fun, [xmin xmax]) Fun(x) fun(xmin) } fun(xmax) } must differ in sign (one positive and one negative) only one zero return is error fun(x)=0 x=x0 fun character string denoting the function. @cos = cos": matlab predefined function: quad(fun,xmin,xmax) = numerical quadrature(integral) xmax xmin. Design of function functions relies on eval and feval. Eval(string) - evaluates a character string as if it were typed in the command window. X = string sin(pi/2) would appear in the command window. Y = eval(string) = 1 will look at this string and produce the same result as if sin(pi/2) had been typed in the command window. Feval(fun,value) - takes a function defined by m-file fun. m and evaluates it at specified input value.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers