Error on phase diagram

1 visualización (últimos 30 días)
Michael Hay
Michael Hay el 2 de Ag. de 2021
Comentada: Michael Hay el 2 de Ag. de 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

Respuesta aceptada

Chunru
Chunru el 2 de Ag. de 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 comentarios
Michael Hay
Michael Hay el 2 de Ag. de 2021
Thank you so much!
Michael Hay
Michael Hay el 2 de Ag. de 2021
What a silly mistake lol

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by