フィルターのクリア

how to solve the equation: xdot=AX+Bu; where u=sin(2t)

56 ビュー (過去 30 日間)
Ebraheem Menda
Ebraheem Menda 2019 年 11 月 28 日
コメント済み: Ebraheem Menda 2019 年 12 月 4 日
This is my system. I want to solve it using ode45.
I have solved this using ode45 but by keeping sin(2t)=0. the following is the code.
What changes i need to do to the following to solve my actual system.
function [y]= smc3()
clc
a=[0 1;-3 -4];
b=[0 1];
c=[1 0];
ic=[1 -2];
i=zeros(1,2);
[t y]=ode45(@smc4,[0 8],ic);
function [di]= smc4(~,i)
di = zeros(2,1); % a column vector
di(1) = a(1,1)*i(1)+a(1,2)*i(2)-b(1);
di(2) = a(2,1)*i(1)+a(2,2)*i(2)-b(2);
end
id=y(:,1);
iq=y(:,2);
plot(t,y(:,1),t,y(:,2));
end
Thanks in advance !!!!!
  1 件のコメント
Ebraheem Menda
Ebraheem Menda 2019 年 11 月 28 日
Is there any other function to solve this If not possible with ode45.

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

採用された回答

David Goodmanson
David Goodmanson 2019 年 12 月 2 日
Hi Ebraheem,
ode45 is fine with explicit time dependence in the calculation of xdot:
[t, x] = ode45(@smc5,[0, 10],[1, -2])
plot(t,x)
grid on
function xdot = smc5(t,x)
xdot = [0 1;-3 -4]*x + [0; 1]*sin(2*t);
end
  1 件のコメント
Ebraheem Menda
Ebraheem Menda 2019 年 12 月 4 日
Thank you verymuch Mr.David.You have shown me the simple way to write the code for my problem.
i will again comeback with few more questions.
Thank You.

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2014b

Community Treasure Hunt

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

Start Hunting!

Translated by