I can't graph multivariable function that contains cos function doens't work
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
수정 이
am 28 Okt. 2020
Kommentiert: 수정 이
am 28 Okt. 2020
I'm trying to graph f(x,y)=(e^x )* cos(y)
By using ulframalpha, I found that the graph should look like this.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/394693/image.gif)
>> x=[-4*pi:0.1:4*pi];
>> y=[-4*pi:0.1:4*pi];
>> [X,Y]=meshgrid(x,y);
>> Z=exp(X)*cos(Y);
>> surf(X,Y,Z)
My code look like this, and the result keep shows me this, flat plane.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/394698/image.png)
I changed range for several times, but I don't think that range is not problem.
Can you see any problem in my code?
Any help would be aprreciated.
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 28 Okt. 2020
Z=exp(X).*cos(Y);
Remember that the * operator is matrix multiplication (inner product). Multiplication of corresponding elements requires the .* operator.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Construction 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!