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 日間)
古いコメントを表示
Md Shahidul Alam
2016 年 2 月 15 日
コメント済み: Md Shahidul Alam
2016 年 2 月 15 日
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
0 件のコメント
採用された回答
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.
その他の回答 (0 件)
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!