Effacer les filtres
Effacer les filtres

Error on phase diagram

2 vues (au cours des 30 derniers jours)
Michael Hay
Michael Hay le 2 Août 2021
Commenté : Michael Hay le 2 Août 2021
I am having a hard time getting this phase diagram to work it is suposed to be a vortex patterin around the origin and im getting some weird results for this.
The error I am getting is
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate.
RCOND = 2.040317e-19.
> In PhasePortrait (line 19)
function PhasePortrait()
x=[-1:0.05:1];
y=[-1:0.05:1];
m=length(x);
n=length(y);
xc=zeros(m,n);
yc=zeros(m,n);
for i=1:m
for j=1:n
xc(j,i)=y(j);
yc(j,i)=((((-4*129944)/601)*x(i))-(((4*6000/601))*y(j)))/100;
end
end
figure (1)
plot(x,0*x,':k')
plot(0*y,y,':k')
arrow=sqrt(xc.^2 + yc.^2);
quiver(x,y,xc./arrow,yc/arrow,0.5,'b')
xlim([min(x),max(x)])
ylim([min(y),max(y)])
hold on
grid on
axis tight

Réponse acceptée

Chunru
Chunru le 2 Août 2021
x=[-1:0.05:1];
y=[-1:0.05:1];
m=length(x);
n=length(y);
xc=zeros(m,n);
yc=zeros(m,n);
for i=1:m
for j=1:n
xc(j,i)=y(j);
yc(j,i)=((((-4*129944)/601)*x(i))-(((4*6000/601))*y(j)))/100;
end
end
figure (1);
plot(x,0*x,':k');
hold on % hold on here
plot(0*y,y,':k')
arrow=sqrt(xc.^2 + yc.^2);
% ./ instead of / for yc
quiver(x,y,xc./arrow,yc./arrow,0.5,'b')
xlim([min(x),max(x)])
ylim([min(y),max(y)])
%hold on
grid on
axis tight
  2 commentaires
Michael Hay
Michael Hay le 2 Août 2021
Thank you so much!
Michael Hay
Michael Hay le 2 Août 2021
What a silly mistake lol

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by