How to write exponential function that accepts vectors ?
Show older comments
o, say I want to write a function 's' for e^(10x) * e^(cosx)
function value=s(x)
value=exp(10*x)*exp(cos(x)) ;
this will only accept scalars. What if I wanted it to accept matrix & vector too? I know expm will allow matrix, but when I do s([1 2 4]) it spits out an error: Expected input to be a square matrix.
So, how can I have the same effect as ".^" with an exponential?
Answers (1)
Star Strider
on 13 Feb 2018
Try this:
value = @(x) exp(10*x).*exp(cos(x));
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!