ode45,Too many output arguments error

2 次查看(过去 30 天)
The equation is complex , I can not get the solution, how can I solve it?

采纳的回答

Jan
Jan 2022-3-23
编辑:Jan 2022-3-23
The complete error message is (remember to include it in a question, whenever an error occurs):
Error using vertcat
The following error occurred converting from double to function_handle:
Too many output arguments.

Error in solution>mart (line 123)
F = [m(1)*e(1)*w^2*cwt+c(1)*e(1)*w*swt-c(1)*e(2)*w*swt-k(1)*e(1)*cwt+k(1)*e(2)*cwt+Fz(t)

Error in odearguments (line 92)
f0 = ode(t0,y0,args{:}); % ODE15I sets args{1} to yp0.

Error in ode23 (line 106)
odearguments(odeIsFuncHandle, odeTreatAsMFile, solver_name, ode, tspan, y0, options, varargin);
The Problem occurs here:
function [du] = mart( t,u )
...
Mt=@(t) 9.6*sin(w*t);
...
F = [m(1)*e(1)*w^2*cwt+c(1)*e(1)*w*swt-c(1)*e(2)*w*swt-k(1)*e(1)*cwt+k(1)*e(2)*cwt+Fz(t)
m(2)*e(2)*w^2*cwt-c(1)*e(1)*w*swt+c(1)*e(2)*w*swt+c(2)*e(2)*w*swt-c(2)*e(3)*w*swt+k(1)*e(1)*cwt-k(1)*e(2)*cwt-k(2)*e(2)*cwt-k(2)*e(3)*cwt
m(3)*e(3)*w^2*cwt-c(2)*e(2)*w*swt+c(2)*e(3)*w*swt+c(3)*e(3)*w*swt-c(3)*e(4)*w*swt+k(2)*e(2)*cwt-k(2)*e(3)*cwt-k(3)*e(3)*cwt-k(3)*e(4)*cwt
m(4)*e(4)*w^2*cwt-c(3)*e(3)*w*swt+c(3)*e(4)*w*swt+c(4)*e(4)*w*swt-c(4)*e(5)*w*swt+k(3)*e(3)*cwt-k(3)*e(4)*cwt-k(4)*e(4)*cwt-k(4)*e(5)*cwt
m(5)*e(5)*w^2*swt+c(4)*e(4)*w*swt-c(4)*e(5)*w*swt-k(4)*e(4)*cwt+k(4)*e(5)*cwt
m(1)*e(1)*w^2*swt+c(1)*e(1)*w*swt-c(1)*e(2)*w*swt-k(1)*e(1)*cwt+k(1)*e(2)*cwt+Fy(t)
m(2)*e(2)*w^2*swt+c(1)*e(1)*w*cwt-c(1)*e(2)*w*cwt-c(2)*e(2)*w*cwt+c(2)*e(3)*w*cwt+k(1)*e(1)*swt-k(1)*e(2)*swt-k(2)*e(2)*swt+k(2)*e(3)*swt
m(3)*e(3)*w^2*swt+c(2)*e(2)*w*cwt-c(2)*e(3)*w*cwt-c(3)*e(3)*w*cwt+c(3)*e(4)*w*cwt+k(2)*e(2)*swt-k(2)*e(3)*swt-k(3)*e(3)*swt+k(3)*e(4)*swt
m(4)*e(4)*w^2*swt+c(3)*e(3)*w*cwt-c(3)*e(4)*w*cwt-c(4)*e(4)*w*cwt+c(4)*e(5)*w*cwt+k(3)*e(3)*swt-k(3)*e(4)*swt-k(4)*e(4)*swt+k(4)*e(5)*swt
m(5)*e(5)*w^2*swt+c(4)*e(4)*w*swt-c(4)*e(5)*w*swt-k(4)*e(4)*cwt+k(4)*e(5)*cwt
Mt % <== here! Mt is a function handle and needs an argument
0
0
0
0];
Maybe you mean Mt(t).

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by