x = -2:0.1:2;
y = cos(x)+exp(-1/2*x.^2)*sin(6*x)
plot(x,y)
This is my code, I keep getting
Error in test (line 2) y = cos(x)+exp(-1/2*x.^2)*sin(6*x);
But I cant figure out what I am doing wrong.

 Akzeptierte Antwort

Stephan
Stephan am 16 Sep. 2018
Bearbeitet: Stephan am 16 Sep. 2018

0 Stimmen

x = -2:0.01:2;
y = cos(x)+exp(-1/2*x.^2).*sin(6*x);
plot(x,y)

2 Kommentare

Nirvan Hashemian
Nirvan Hashemian am 16 Sep. 2018
Thank you!
Neelanjan Pal
Neelanjan Pal am 16 Nov. 2019
Bearbeitet: Neelanjan Pal am 16 Nov. 2019
when the code is as SUCH;
syms x y C
x = -2:0.01:2;
C=12/(cos(x)+exp(-1/2*x.^2).*sin(6*x));
plot(x,C)
error:
Error using /
Matrix dimensions must agree.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Graph and Network Algorithms finden Sie in Hilfe-Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by