is my program for solving differential equation is correct or not?

1 回表示 (過去 30 日間)
SAHIL SAHOO
SAHIL SAHOO 2022 年 9 月 3 日
編集済み: Torsten 2022 年 9 月 3 日
to solve this couple differential equation i wrote a program,
Z1....Z5 is y(1)...y(5), X1...X5 is y(6).......y(10) and Φ1.......Φ5 is y(11).....y(15)
hence I want to sovle another equation which is
Φ2 - Φ1 = y(16)
Φ3 - Φ2 = y(17)
Φ4 - Φ3 = y(18)
Φ5 - Φ4 = y(19)
Φ1 - Φ5 = y(20)
while solving these equation I didn't ge any fluctuation in the graph is my program correct or not?
clc
ti = 0;
tf = 70E-9;
tspan=[ti tf];
tp =1E-12;
T = 2E3;
P = 0.05;
k = (0.62).*10^(0);
c = 3E8;
N = 3;
n = k*(c/N)*tp
a = 3;
f = @(t,y) [
(P - y(1) - ((2.*y(1) +1).*(((y(6)))^2)))./T;
(P - y(2) - ((2.*y(2) +1).*(((y(7)))^2)))./T;
(P - y(3) - ((2.*y(3) +1).*(((y(8)))^2)))./T;
(P - y(4) - ((2.*y(4) +1).*(((y(9)))^2)))./T;
(P - y(5) - ((2.*y(5) +1).*(((y(10)))^2)))./T;
(y(1).*y(6)) - n.*(y(7).*sin(y(12) - y(11)) + y(10).*sin(y(15)- y(11)));
(y(2).*y(7)) - n.*(y(8).*sin(y(13) - y(12)) + y(6).*sin(y(11) - y(12)));
(y(3).*y(8)) - n.*(y(9).*sin(y(14) - y(13)) + y(7).*sin(y(12) - y(13)));
(y(4).*y(9)) - n.*(y(10).*sin(y(15) - y(14)) + y(8).*sin(y(13) - y(14)));
(y(5).*y(10)) - n.*(y(6).*sin(y(11) - y(15)) + y(9).*sin(y(14) - y(15)));
-a.*(y(1))+ n.*((y(7)./y(6)).*(cos(y(12) - y(11))) + (y(10)/y(6)).*(cos(y(15) - y(11))));
-a.*(y(2))+ n.*((y(8)./y(7)).*(cos(y(13) - y(12))) + (y(6)/y(7)).*(cos(y(11) - y(12))));
-a.*(y(3))+ n.*((y(9)./y(8)).*(cos(y(14) - y(13))) + (y(7)/y(8)).*(cos(y(12) - y(13))));
-a.*(y(4))+ n.*((y(10)./y(9)).*(cos(y(15) - y(14))) + (y(8)/y(9)).*(cos(y(13) -y(14))));
-a.*(y(5))+ n.*((y(6)./y(10)).*(cos(y(11) - y(15))) + (y(9)/y(10)).*(cos(y(14) - y(15))));
y(12) - y(11);
y(13) - y(12);
y(14) - y(13);
y(15) - y(14);
y(11) - y(15);
];
y0=[0; 0; 0; 0; 0; 0.6; 0.6; 0.6 ; 0.6; 0.6; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0]*10E-3;
[time,Y] = ode45(f,tspan./tp,y0);
plot(time,Y(:,16));
hold on
plot(time,Y(:,18));
plot(time,Y(:,17));
plot(time,Y(:,19));
plot(time,Y(:,20));
hold off
n = 0.5167
  3 件のコメント
SAHIL SAHOO
SAHIL SAHOO 2022 年 9 月 3 日
hello
I X1...X5 are the amplitude and i assing them from y(6)...y(10), and phi are the phase and i assing them y(11)...y(15).
I edited the code you can clearly see the cos(phi_j+1 - phi_j), cos(phi_j - phi_j-1), sin(phi_j+1 - phi_j), sin(phi_j - phi_j-1)
and your third point, I don't know how to do that please tell me.
thanks
Torsten
Torsten 2022 年 9 月 3 日
編集済み: Torsten 2022 年 9 月 3 日
your third point, I don't know how to do that please tell me.
Remove y(16) up to y(20) from the function for the differential equation and use
hold on
plot(time,Y(:,12)-Y(:,11))
plot(time,Y(:,13)-Y(:,12))
plot(time,Y(:,14)-Y(:,13))
plot(time,Y(:,15)-Y(:,14))
plot(time,Y(:,11)-Y(:,15))
hold off
instead of
plot(time,Y(:,16));
hold on
plot(time,Y(:,18));
plot(time,Y(:,17));
plot(time,Y(:,19));
plot(time,Y(:,20));
hold off

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

回答 (0 件)

カテゴリ

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