I can correct the error. Help me please!!
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
My code is:
x = linspace(-pi/2,pi/2,40);
y = x;
[X,Y] = meshgrid(x,y);
f = sin(X.ˆ2-Y.ˆ2);
figure(1)
contour(X,Y,f)
figure(2)
contourf(X,Y,f,20)
figure(3)
surf(X,Y,f)
the error is: ??? f = sin(Xˆ2-Yˆ2); |
Error: The input character is not valid in MATLAB statements or expressions.
How can I solve it?
0 commentaires
Réponse acceptée
Plus de réponses (1)
Wayne King
le 9 Mai 2013
Modifié(e) : Wayne King
le 9 Mai 2013
The problem is the character you have in for "^", not sure where you entered that in from, but copy and paste the below directly into the MATLAB workspace.
x = linspace(-pi/2,pi/2,40);
y = x;
[X,Y] = meshgrid(x,y);
f = sin(X.^2-Y.^2);
figure(1)
contour(X,Y,f)
figure(2)
contourf(X,Y,f,20)
figure(3)
surf(X,Y,f)
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!