How to properly write e^(sin(x)^3) x^6-2x^4-x^

1 view (last 30 days)
John  Warner
John Warner on 28 Mar 2018
Edited: Walter Roberson on 28 Mar 2018
I have it written this way :
f= @(x)(exp((sin(x))^3)+x^6-2*x^4-x^3-1);
but it is not giving me the correct answer when it gets run through my code. THANKS!

Answers (1)

Star Strider
Star Strider on 28 Mar 2018
You need to use Vectorization (link):
f= @(x)(exp(sin(x).^3) + x.^6 - 2*x.^4 - x.^3 - 1);
x = linspace(-pi, pi);
plot(x, f(x))
grid

Categories

Find more on MATLAB in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!