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 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