I keep getting this error...
Afficher commentaires plus anciens
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!
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Surface and Mesh Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!