フィルターのクリア

How can I add Direction arrows in this Phase Portrait I mean arrows in the Direction of velocity

2 ビュー (過去 30 日間)
clear
clc
clf
close all
k1 = 3;
k_1 = 1;
k2 = 3;
k3 = 0.6;
k_3 = 1;
k4 = 3;
f = @(t,a) [k_1*a(2)-k1*a(1)-k3*a(1)*a(2)-k_3*a(3);
k1*a(1)-(k_1+k2)*a(2)-k3*a(1)*a(2)+(k4+k_3)*a(3);
k3*a(1)*a(2)-(k4+k_3)*a(3)];
[t,a] = ode45(f,[0 100],[4.1 1.1 0]); % Runge-Kutta 4th/5th order ODE solver
plot3(a(:,1),a(:,2),a(:,3))
hold on
grid on
xlabel('S','fontsize',12)
ylabel('C1','fontsize',12)
zlabel('C2','fontsize',12)
[t,a] = ode45(f,[0 100],[4 1 0]); % Runge-Kutta 4th/5th order ODE solver
plot3(a(:,1),a(:,2),a(:,3))
[t,a] = ode45(f,[0 100],[3.9 .9 0]); % Runge-Kutta 4th/5th order ODE solver
plot3(a(:,1),a(:,2),a(:,3))
[t,a] = ode45(f,[0 100],[3.8 .8 0]); % Runge-Kutta 4th/5th order ODE solver
plot3(a(:,1),a(:,2),a(:,3))
[t,a] = ode45(f,[0 100],[3.7 .7 0]); % Runge-Kutta 4th/5th order ODE solver
plot3(a(:,1),a(:,2),a(:,3))
[t,a] = ode45(f,[0 100],[3.6 .6 0]); % Runge-Kutta 4th/5th order ODE solver
plot3(a(:,1),a(:,2),a(:,3))
[t,a] = ode45(f,[0 100],[3.5 .5 0]); % Runge-Kutta 4th/5th order ODE solver
plot3(a(:,1),a(:,2),a(:,3))
[t,a] = ode45(f,[0 100],[3.4 .4 0]); % Runge-Kutta 4th/5th order ODE solver
plot3(a(:,1),a(:,2),a(:,3))
[t,a] = ode45(f,[0 100],[3.3 .3 0]); % Runge-Kutta 4th/5th order ODE solver
plot3(a(:,1),a(:,2),a(:,3))
[t,a] = ode45(f,[0 100],[3.2 .2 0]); % Runge-Kutta 4th/5th order ODE solver
plot3(a(:,1),a(:,2),a(:,3))
[t,a] = ode45(f,[0 100],[3.1 .1 0]);
plot3(a(:,1),a(:,2),a(:,3))
hold off
  7 件のコメント
Rik
Rik 2021 年 12 月 21 日
Original question content (the attached SC1C2best.m file can't be restored from Google cache):
clear
clc
clf
close all
k1 = 3;
k_1 = 1;
k2 = 3;
k3 = 0.6;
k_3 = 1;
k4 = 3;
f = @(t,a) [k_1*a(2)-k1*a(1)-k3*a(1)*a(2)-k_3*a(3);
k1*a(1)-(k_1+k2)*a(2)-k3*a(1)*a(2)+(k4+k_3)*a(3);
k3*a(1)*a(2)-(k4+k_3)*a(3)];
[t,a] = ode45(f,[0 100],[4.1 1.1 0]); % Runge-Kutta 4th/5th order ODE solver
plot3(a(:,1),a(:,2),a(:,3))
hold on
grid on
xlabel('S','fontsize',12)
ylabel('C1','fontsize',12)
zlabel('C2','fontsize',12)
[t,a] = ode45(f,[0 100],[4 1 0]); % Runge-Kutta 4th/5th order ODE solver
plot3(a(:,1),a(:,2),a(:,3))
[t,a] = ode45(f,[0 100],[3.9 .9 0]); % Runge-Kutta 4th/5th order ODE solver
plot3(a(:,1),a(:,2),a(:,3))
[t,a] = ode45(f,[0 100],[3.8 .8 0]); % Runge-Kutta 4th/5th order ODE solver
plot3(a(:,1),a(:,2),a(:,3))
[t,a] = ode45(f,[0 100],[3.7 .7 0]); % Runge-Kutta 4th/5th order ODE solver
plot3(a(:,1),a(:,2),a(:,3))
[t,a] = ode45(f,[0 100],[3.6 .6 0]); % Runge-Kutta 4th/5th order ODE solver
plot3(a(:,1),a(:,2),a(:,3))
[t,a] = ode45(f,[0 100],[3.5 .5 0]); % Runge-Kutta 4th/5th order ODE solver
plot3(a(:,1),a(:,2),a(:,3))
[t,a] = ode45(f,[0 100],[3.4 .4 0]); % Runge-Kutta 4th/5th order ODE solver
plot3(a(:,1),a(:,2),a(:,3))
[t,a] = ode45(f,[0 100],[3.3 .3 0]); % Runge-Kutta 4th/5th order ODE solver
plot3(a(:,1),a(:,2),a(:,3))
[t,a] = ode45(f,[0 100],[3.2 .2 0]); % Runge-Kutta 4th/5th order ODE solver
plot3(a(:,1),a(:,2),a(:,3))
[t,a] = ode45(f,[0 100],[3.1 .1 0]);
plot3(a(:,1),a(:,2),a(:,3))
hold off

サインインしてコメントする。

回答 (1 件)

Walter Roberson
Walter Roberson 2021 年 12 月 19 日
編集済み: Walter Roberson 2021 年 12 月 19 日
You cannot add velocity direction vectors to that plot, as none of your variables are velocity, and none of your variables allow velocity to be calculated (for example they are not acceleration.)
In order to plot velocity direction vectors, you need one of a small number of things:
  1. x and y, or x and y and z components of the velocity at a series of x and y, or x and y and z locations
  2. magnitude and direction components of the velocity at a series of x and y, or x and y and z locations
  3. x and y, or x and y and z components of the velocity at a series of 2d polar or 3d spherical or 3d cylindrical coordinates
  4. magnitude and direction components of the velocity at a series of 2d polar or 3d spherical or 3d cylindrical coordinates

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by