Why doesn't this matlab code work?!
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Aryo Aryanapour
am 19 Apr. 2021
Kommentiert: Aryo Aryanapour
am 20 Apr. 2021
>> x = -5:1:5;
>> y = exp(x)*(x.^3-5*x.^2+5*x+1);
Error using *
Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix
matches the number of rows in the second matrix. To perform elementwise multiplication, use '.*'.
Related documentation
>> plot(x,y)
Unrecognized function or variable 'y'.
thank you
0 Kommentare
Akzeptierte Antwort
the cyclist
am 20 Apr. 2021
You missed a spot where you needed an element-wise operation, multiplying the exp(x) by the other term:
x = -5:1:5;
y = exp(x).*(x.^3-5*x.^2+5*x+1);
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!