필터 지우기
필터 지우기

I have a dynamic system. The equation is ddot = (M)\(F - K*d); Where M,K are (4,4) constant matrix and F and d are vector. I want to solve this equation using ODE45.

조회 수: 2 (최근 30일)
In my case The force vector F is variable. The values are changing with time. So to solve ode I've used a for loop. To update the solution of ODE45 I need to use something like this 'T(i,:)'. but it's showing an error 'Subscripted assignment dimension mismatch.' How can I solve an ode for variable dc input?
for i = 1:100
p1 = (power.dat)';
F = p1(:,i);
d0 = [333,333,333,333];
tspan = 0:0.1:1;
[t,T(i,:)] = ode45('Heat',tspan,d0);
end

채택된 답변

Walter Roberson
Walter Roberson 2016년 2월 15일
When you use more than two entries in tspan (as you have done here), the second output of ode45 will be length(tspan) by length(d0) -- that is, it will have the integrals of each of the 4 elements, at each of the time steps. If you only need one of those 4 columns, then output to a variable and select the column you need.
  댓글 수: 1
Md Shahidul Alam
Md Shahidul Alam 2016년 2월 15일
Thank you Mr. Roberson for your kind response. Actually my problem is the force vector F is a function of tspan's step size. The force vector is changing with the step size. The equation,ddot = (M)\(F(step size) - K*d);Normally in all tutorials,examples, I've found that the force vector is constant. In my case it's changing with step size. Is it possible to use ODE function in that case? Thanks in advance!

댓글을 달려면 로그인하십시오.

추가 답변 (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