ode45,Too many output arguments error

7 ビュー (過去 30 日間)
Gloria
Gloria 2022 年 3 月 23 日
コメント済み: Gloria 2022 年 3 月 23 日
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).
  2 件のコメント
Gloria
Gloria 2022 年 3 月 23 日
It should be Mt(t)
Gloria
Gloria 2022 年 3 月 23 日
Thank you so much, I though the problem was caused by the matrix size

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by