Unsure what I did wrong
Ältere Kommentare anzeigen
I want to plot a graph of y against x:
x=[0:2*pi]
y=exp(1)^x
plot(x,y)
But this error showed:
Error using ^ (line 51)
Incorrect dimensions for raising a matrix to a power. Check that the matrix is
square and the power is a scalar. To perform elementwise matrix powers, use '.^'.
Akzeptierte Antwort
Weitere Antworten (1)
Steven Lord
am 15 Feb. 2020
Don't try to raise exp(1) to the power of x. Just use exp on the array x directly.
x = 1:5;
y = exp(x);
1 Kommentar
David Hill
am 16 Feb. 2020
Yes!
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!