Undefined function 'mtimes' for input arguments of type 'struct'.

Hello! Please I need a help here? Here is my script
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% x=[1 1.2 1.3 1.4 1.5];
A=[-1.3 -0.6; -0.5 -0.6];
Ad=[0.1 0; 0.1 0.1];
s=[0;0]; alpha=0.5; t1=0.1; x_tau_d=[0.7;0.6];
for k=0:0.01:1000
fun1=@(tau,y) (t1-tau).^(k+1).*x_tau_d(1);
fun2=@(tau,y) (t1-tau).^(k+1).*x_tau_d(2);
s = s + [ode45(fun1,[0 t1],0);ode45(fun2,[0 t1],0)];
end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Thanks,

1 件のコメント

Jan
Jan 2016 年 11 月 17 日
Please post the complete error message, such that we do not have to guess the line, which causes the error.

回答 (1 件)

Alexandra Harkai
Alexandra Harkai 2016 年 11 月 17 日

0 投票

This gave me a different error in the first loop:
Undefined operator '+' for input arguments of type 'struct'.
Which is coming from the fact that the result of ode45() is a struct array with a few fields. Then the arithmetics won't make sense on a struct. You can pick the solutions you need from there:
sol1 = ode45(fun1,[0 t1],0); sol2 = ode45(fun2,[0 t1],0);
s = s + [sol1.y; sol2.y];

この質問は閉じられています。

タグ

質問済み:

2016 年 11 月 17 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by