필터 지우기
필터 지우기

Why my stable point is not in [0,0]?

조회 수: 2 (최근 30일)
Frantisek Stloukal
Frantisek Stloukal 2021년 4월 29일
댓글: Frantisek Stloukal 2021년 5월 2일
Hi, I am trying to plot this phase-time portrait by code I have found here. I don't know why my stable point is not in [0,0] but is shifted to aproximately [11,11]. Any ideas how to repair this problem ? Thanks a lot.
the code:
figure()
%phase-time
[X1,X2] = meshgrid(-5:0.5:5);
xs = arrayfun(@(x,y) {odeFun([],[x,y])}, X1, X2);
x1s = cellfun(@(x) x(1), xs);
x2s = cellfun(@(x) x(2), xs);
quiver(x1s, x2s)
xlabel('x_1')
ylabel('x_2')
axis tight
function dxdt = odeFun(t,x)
global A %pre-difined matrix of autonomous system of ODE's
dxdt(1) = A(1,1)*x(1)+A(1,2)*x(2);
dxdt(2) = A(2,1)*x(1)+A(2,2)*x(2);
end
  댓글 수: 2
jessupj
jessupj 2021년 4월 29일
편집: jessupj 2021년 4월 29일
my guess is that (0,0) corresponds to [X1(11,11),X2(11,11)]. that is, the plot is plotting arrows at locations based on the index of the vectors since you are not telling it what the coordinates are.
try reading the documetnation of quiver to add the location arguments, probably something like
quiver( x1s,x2s, X1, X2)
Frantisek Stloukal
Frantisek Stloukal 2021년 4월 30일
편집: Frantisek Stloukal 2021년 4월 30일
I have tried that. The portrait center is now in [0,0] as it should be, although it looks like a distorted banana :D What is interesting is that when equilibrium points are type center or focus it works (when eigen numbers are complex), but when saddle or node it by some reason colaps into this:
PS: thanks for advice

댓글을 달려면 로그인하십시오.

채택된 답변

Jan
Jan 2021년 4월 30일
Your command for creating the diagram does not get any information about the X and Y coordiantes:
quiver(x1s, x2s)
Then it assume, that the coordinates are going from 1 to the number of elements in each direction.
Provide the X and Y coordinates, if you want so see them:
quiver(X1, X2, x1s, x2s)
Trying to run your code produces an errort message, e.g. due to the missing variable A. So please test this by your own.
  댓글 수: 2
jessupj
jessupj 2021년 4월 30일
try@Jan's suggestion... mine reversed the position and arrow vectors. ALWAYS read doumentation on matlab functions.
Frantisek Stloukal
Frantisek Stloukal 2021년 5월 2일
Works pretty good for me. Thank you @Jan.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by