what's means this error?

9 次查看(过去 30 天)
Nashira
Nashira 2013-8-30
Error using odearguments (line 93)
INT_ALPHA returns a vector of length 151, but the length of initial conditions vector is 1. The vector returned by INT_ALPHA and the initial conditions vector must have the same number of elements.
Error in ode45 (line 114)
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...
Error in miscela_dopo_urto_normale (line 136)
[j,S] = ode45(@int_alpha , t, 0);
Thanks in advance for any help!

采纳的回答

dpb
dpb 2013-8-30
As the error says, you have to have an initial condition value for each equation in the integrated system of equations. Your function has 151 return values it seems but you only provided a single initial condition.
Whether that's an error in the definition of the function that is intended to only have one equation so it's wrong or whether the function is right and you need zeros(151,1) as the IC vector is indeterminate from the data provided--only you know what is the actual problem definition.
  1 个评论
Nashira
Nashira 2013-8-30
my matlab function should integrate an equation such as: dalpha / dt = f (alpha) I then added a single initial condition since I have a single equation of the first order .. is that right?

请先登录,再进行评论。

更多回答(1 个)

Nashira
Nashira 2013-8-30
my matlab function should integrate an equation such as: dalpha / dt = f (alpha) I then added a single initial condition since I have a single equation of the first order .. is that right?
  2 个评论
dpb
dpb 2013-8-30
Yes. If that is the case then you likely have something like a missing '.*' or the like that is returning a vector product instead of a single value or the like.
Your mission, should you choose to accept it, is to delve into your function code and see why it's not returning a single value but an array of 151 values.
Nashira
Nashira 2013-8-30
ok thank you very much!

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by