Error on phase diagram

1 view (last 30 days)
Michael Hay
Michael Hay on 2 Aug 2021
Commented: Michael Hay on 2 Aug 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

Accepted Answer

Chunru
Chunru on 2 Aug 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 Comments
Michael Hay
Michael Hay on 2 Aug 2021
Thank you so much!
Michael Hay
Michael Hay on 2 Aug 2021
What a silly mistake lol

Sign in to comment.

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!