Info

此问题已关闭。 请重新打开它进行编辑或回答。

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

1 次查看(过去 30 天)
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
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];

标签

Community Treasure Hunt

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

Start Hunting!

Translated by