# I want the phase portrait show arrow direction

조회 수: 5 (최근 30일)
Nur Wahidiyatil 2023년 2월 19일
댓글: Nur Wahidiyatil 2023년 2월 25일
I have coding matlab about phase portrait using equiver for add arrow direction (direction field) but arrow direction didn't clearly visible. This is coding matlab I use
This is the coding function
function dy=fungsipotretfasepemodelanedit(t,y)
global k a1 a2 b1 b2 e1 e2 m r q s w1 w2 ;
dy=zeros(5,1);
dy(1)= k+(e2*y(1)*y(2))-(a1*y(1)*y(3))-(e1*y(1)*y(2))-(m*y(1))-(b1*y(1)*y(4)) ;
dy(2)=(e1*y(1)*y(2))-(a2*y(2)*y(3))-(b2*y(2)*y(4))-(m*y(2))-(e2*y(1)*y(2));
dy(3)= (a1*y(1)*y(3))+(a2*y(2)*y(3))-(w1*y(3))-(m*y(3))-(r*y(3))-(s*y(3)*y(4));
dy(4)= (b1*y(1)*y(4))+(b2*y(2)*y(4))-(m*y(4))-(w2*y(4));
dy(5)= (w1*y(3))+(w2*y(4))+(s*y(3)*y(4))-(m*y(5))-(q*y(5));
end
this is the coding for run phase portrait
clc; close all; clear all;
figure1 = figure ;
axes1 = axes ( 'Parent' , figure1 , 'fontsize' , 13 ) ;
grid on;
box(axes1,'on') ;
hold(axes1,'all') ;
global k e1 e2 a1 a2 b1 b2 m r q w1 w2 s;
k=40;
e1=0.07;
e2=0.05;
a1=0.08;
a2=0.02;
b1=0.07;
b2=0.03;
m=0.2;
r=0.03;
q=0.05;
w1=0.4;
w2=0.47;
s=0.02;
[t1,y1]=ode45(@fungsipotretfasepemodelanedit,[0 1000],[20 20 10 20 5]);
[t2,y2]=ode45(@fungsipotretfasepemodelanedit,[0 1000],[20 18 10 50 20]);
[t3,y3]=ode45(@fungsipotretfasepemodelanedit,[0 1000],[50 10 90 40 20]);
[t4,y4]=ode45(@fungsipotretfasepemodelanedit,[0 1000],[10 50 90 40 10]);
figure(1);
plot(y1(:,1), y1(:,2),'blue',y2(:,1), y2(:,2),'red',y3(:,1),y3(:,2),'green',y4(:,1),y4(:,2),'black','linewidth',2);
plotArrows(y1),
plotArrows(y2),
plotArrows(y3),
plotArrows(y4),
legend('Nilai Awal 1','Nilai Awal 2','Nilai Awal 3','Nilai Awal 4');
xlabel('Jumlah Populasi Rentan yang Memiliki Berat Badan Normal');
ylabel('Jumlah Populasi Rentan yang Obesitas');

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

### 답변 (1개)

Simon Chan 2023년 2월 19일
The Auto Scale property in function quiver may make the arrow length looks small.
You may adjust the AutoScaleFactor to a large value in your case as follows:
##### 댓글 수: 1이전 댓글 -1개 표시이전 댓글 -1개 숨기기
Nur Wahidiyatil 2023년 2월 25일
Thank you so much

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

### 카테고리

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

R2007b

### Community Treasure Hunt

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

Start Hunting!

Translated by