フィルターのクリア

What's the alternative of ode45 function ?

8 ビュー (過去 30 日間)
Mallouli Marwa
Mallouli Marwa 2016 年 5 月 26 日
コメント済み: Sebastian Castro 2016 年 5 月 26 日
Hi, i have done this function to resolve a second order differential equation but i want to fix the time as a constant equal to 10 by changing the ode45 by another function:
function xdot = equacte(t,x,rload)
% Function file for mass with spring.
% Position is first variable, velocity is second variable,load is the third variable
freq=100;
w=2*pi*freq;
m=0.0112;
k=279.9919 ;
teta =-7.3333e+03;
cp= 1.8492*10^-7;
A = [0,1,0;-k/m,0,-teta/m;(-teta/rload),0,-1/(rload*cp)];
B = [0;1/m;0];
f =sin(w*t);
xdot = A*x+B*f;
end
Then in principle program:
rload=5000;
[t,x]=ode45(@(t,x) equacte(t,x,rload),[0:0.000001:5],[0,0,0]);

回答 (1 件)

Sebastian Castro
Sebastian Castro 2016 年 5 月 26 日
How about this:
Keep in mind that the variable-step ode45 may be taking much smaller time steps to keep the integration error down. With a fixed-step solver, you have no guarantees of meeting error tolerances and your sample time will have to be carefully chosen.
- Sebastian
  4 件のコメント
Mallouli Marwa
Mallouli Marwa 2016 年 5 月 26 日
No i haven't simulink. Can i use lsim as a relative of ode45 and how ? Please help me
Sebastian Castro
Sebastian Castro 2016 年 5 月 26 日
That might work. You could get away with discretizing the system to your sample rate of 10 using c2d and then passing it in to lsim. According to the documentation,
Discrete-time systems are simulated with ltitr (state space) or filter (transfer function and zero-pole-gain).
- Sebastian

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

カテゴリ

Help Center および File ExchangeGeneral Applications についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by