What is the problem with the following anonymous function? my_fun=@(a,e,x) e^(-a.*x); b=0.5; e=exp(1); x=[0:0.1:10]; figure plot(x,my_fun(b,e,x))

Algebra & Trigonometry with Analytic Geometry
13th Edition
ISBN:9781133382119
Author:Swokowski
Publisher:Swokowski
Chapter3: Functions And Graphs
Section: Chapter Questions
Problem 71RE
icon
Related questions
Question

When you execute the above Matlab code, you will get an error message.
Please choose the reason why the presented Matlab code does not work.

a) Anonymous functions may contain only one variable, not three.

b) The expression in the power might contain a vector. Thus, element-wise operations are needed.

c) When calling an anonymous function, one has to use exactly the same names of the variables as in the definition
of the function.

d) It is not allowed to use the exp()-function in order to compute an value for the variable e beforehand.

What is the problem with the following anonymous function?
my_fun=@(a,e,x) e^(-a.*x);
b=0.5;
e=exp(1);
x=[0:0.1:10];
figure
plot(x,my_fun(b,e,x))
Transcribed Image Text:What is the problem with the following anonymous function? my_fun=@(a,e,x) e^(-a.*x); b=0.5; e=exp(1); x=[0:0.1:10]; figure plot(x,my_fun(b,e,x))
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Algebra & Trigonometry with Analytic Geometry
Algebra & Trigonometry with Analytic Geometry
Algebra
ISBN:
9781133382119
Author:
Swokowski
Publisher:
Cengage
College Algebra
College Algebra
Algebra
ISBN:
9781938168383
Author:
Jay Abramson
Publisher:
OpenStax
Algebra for College Students
Algebra for College Students
Algebra
ISBN:
9781285195780
Author:
Jerome E. Kaufmann, Karen L. Schwitters
Publisher:
Cengage Learning
College Algebra
College Algebra
Algebra
ISBN:
9781305115545
Author:
James Stewart, Lothar Redlin, Saleem Watson
Publisher:
Cengage Learning
College Algebra (MindTap Course List)
College Algebra (MindTap Course List)
Algebra
ISBN:
9781305652231
Author:
R. David Gustafson, Jeff Hughes
Publisher:
Cengage Learning
Intermediate Algebra
Intermediate Algebra
Algebra
ISBN:
9780998625720
Author:
Lynn Marecek
Publisher:
OpenStax College