Anyone know why it isnt accepting my cos(2x) ?

38 views (last 30 days)
x = -pi:2*pi;
f(x) = (cos(2.*x));
plot (f)

Accepted Answer

Ameer Hamza
Ameer Hamza on 22 Oct 2020
x = -pi:2*pi;
f = cos(2.*x); % f(x) is wrong
plot(x, f)
  3 Comments
Stephen23
Stephen23 on 22 Oct 2020
Edited: Stephen23 on 22 Oct 2020
e is not a defined constant. Use exp(x) to calculate e^x
Most likely you will also need element-wise division here:
h = (x^2-x+3)./(x-8);
% ^^
unless you really are trying to solve systems of linear equations.

Sign in to comment.

More Answers (1)

galang andaru ibnu tetuko
galang andaru ibnu tetuko on 24 Jul 2021
how to find max value and error of cos(2x)

Tags

Community Treasure Hunt

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

Start Hunting!