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

 Accepted Answer

x = -pi:2*pi;
f = cos(2.*x); % f(x) is wrong
plot(x, f)

3 Comments

thank you so much! by any chance do you know why my other code is wrong?
x = 0:5
f = (e.^-0.5x).*(cos(15.*x));
g = -2x + 2;
h = (x^2-x+3)/(x-8);
q = sqrt(x)
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.
@Stephen Cobeldick: Thank you!

Sign in to comment.

More Answers (1)

Categories

Find more on Simulink 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!