how to use pulstran with ode45 function

1 回表示 (過去 30 日間)
Hamza Khalil
Hamza Khalil 2019 年 8 月 27 日
コメント済み: Hamza Khalil 2019 年 8 月 27 日
I have tried to use pulstran with ode45 function but i got this problem ''DE_MDOF returns a vector of length 3005, but the length of initial conditions vector is 6. The vector returned by ODE_MDOF and the initial conditions vector must have the same number of elements.''
  2 件のコメント
Jon
Jon 2019 年 8 月 27 日
編集済み: Jon 2019 年 8 月 27 日
The error is telling you that the function which you evaluate to get your derivatives (I assume this is ODE_MDOF) returns a different number of elements than the vector of initial conditions that you are supplying. They should of course be the same as you need to have a derivative for each state and an initial condition for each state. If you still can not figure out where things are going wrong that are resulting in the lengths of the two vectors being inconsistent, then please provide the relevant portions of your code.
Hamza Khalil
Hamza Khalil 2019 年 8 月 27 日
thank you very much for your help im trying to put this function as force
f0=1;
Fs=10000;
Tf=5;
t=0:1/Fs:Tf-1/Fs;
td=0.012; % duty cycle
A0=1; % 10 Volts
F=0;
N=1000; % Number of points
for n=1:N
F=F+(1/n)*cos(n*2*pi*f0*t).*sin(n*pi*td);
end
F=F';
into the ODE45 function but i get ''returns a vector of length 3005'' error. however if i used f=50;
w= 2*pi*f;
A=1;
F= sin(w*t)
it will work just fine

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

回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by