Syntax error in matlab?! Help Please?
Afficher commentaires plus anciens
A part of my code is below. I am plotting a direction field of a differential equation. The second line of code S=-(X.^2 + Y^2)./(X*Y); and it is telling me that "Error using ^
Inputs must be a scalar and a square matrix.
To compute elementwise POWER, use POWER (.^) instead.
Error in Practice640 (line 6)
S=-(X.^2 + Y^2)./(X*Y); "
Could anyone help me in how to type it in so it correctly reads it?
[X,Y]=meshgrid(-5:0.1:5, -4:0.1:4);
S=-(X.^2 + Y^2)./(X*Y);
L=sqrt(1+S.^2);
figure
hold on
quiver(X, Y, 1./L, S./L,0.4,'.')
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur MATLAB 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!