Can anyone help me to write Matlab code to plot f(x)=0.1e^-x sin(4x^3) and g(x)= -f(x)
Show older comments
i need help to write Matlab code functions for the equation above.thanks.
Answers (1)
Star Strider
on 12 Aug 2015
You left out a few operators, so I did some guessing. This code uses anonymous functions.
f = @(x) 0.1.*exp(-x) .* sin(4*x.^3);
g = @(x) -f(x);
x = linspace(0, 10, 500);
figure(1)
plot(x, f(x), x, g(x))
grid
legend('f(x)', 'g(x)')
The code is straightforward, and all the MATLAB functions and syntax are explained in the documentation.
2 Comments
Brett Sellars
on 13 Aug 2015
Star Strider
on 13 Aug 2015
My pleasure.
If my Answer solved your problem, please Accept it.
Categories
Find more on Annotations 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!