I keep getting this error...
显示 更早的评论
The error is: Error using mesh (line 70) Z must be a matrix, not a scalar or vector.
Here is my code, and I do not know how to correct it so this error does not appear. I am trying to plot a mesh plot of the function I have denoted as g with the x and y intervals that are listed below.
%defining an x-interval
x = [0:0.2:2];
%defining an y-interval
y = [0:0.2:2];
%writing the equation
g = ((exp(1*-y)).*(sin(x)+cos(x)));
%attempting to solve the function
z= polyval(g, x, y)
%
%saving values for g
save('datafile1.mat', 'z')
%plotting the equation as a mesh
[i,j]= meshgrid(x,y);
mesh (i, j, z)
grid on;
hold on;
Can someone please help? Please and Thank you!
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!