how to use pulstran with ode45 function

조회 수: 7 (최근 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 CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by