From: Kevin Reilly on 1 Dec 2009 21:45 Hey all, I am trying to fit parameters to a kinetic model from experimental data through least squares regression, basically just using fmincon, nothing fancy. I am, however, stuck with an issue; MatLab is telling me: ??? Error using ==> odearguments at 116 Solving RATE_FUNC requires an initial condition vector of length 8. The annoying part is that I AM specifying and initial condition vector of length 8: t_stamp = param.measured_data(:,1); x0 = [0; 0; 0.0553; 0; 0; 0; 0; 0]; [t_traj,x_traj] = ode45(@rate_func, t_stamp, x0, [], k2, k3, k4, k5, k6, k7, param); The variable t_stamp is just taking the time stamps of the measured data points so that the ODE solver returns the function value at those times. The function 'rate_func' contains seven chemical rate equations and eight differential equations; hence why I need an initial condition vector of length 8. The variables k2 to k7 are the parameters that I am varying. I have tried even tried entering the code as: [t_traj,x_traj] = ode45(@rate_func, t_stamp, [0; 0; 0.0553; 0; 0; 0; 0; 0], [], k2, k3, k4, k5, k6, k7, param); but to no avail. I've also tried it a row vector; nothin'. If anyone is able to suggest where I might be going wrong or what may be causing this error, it would be greatly appreciated. I have spent hours trying to solve this. Please message me if it would help to see the complete code. Thank you!
From: Eugene on 4 Dec 2009 03:25 "Kevin Reilly" <kevin.t.reilly(a)gmail.com> wrote in message <hf4kbt$46e$1(a)fred.mathworks.com>... > Hey all, > > I am trying to fit parameters to a kinetic model from experimental data through least squares regression, basically just using fmincon, nothing fancy. I am, however, stuck with an issue; MatLab is telling me: > > ??? Error using ==> odearguments at 116 > Solving RATE_FUNC requires an initial condition vector of length 8. > > The annoying part is that I AM specifying and initial condition vector of length 8: > > t_stamp = param.measured_data(:,1); > x0 = [0; 0; 0.0553; 0; 0; 0; 0; 0]; > > [t_traj,x_traj] = ode45(@rate_func, t_stamp, x0, [], k2, k3, k4, k5, k6, k7, param); > > The variable t_stamp is just taking the time stamps of the measured data points so that the ODE solver returns the function value at those times. The function 'rate_func' contains seven chemical rate equations and eight differential equations; hence why I need an initial condition vector of length 8. The variables k2 to k7 are the parameters that I am varying. > > I have tried even tried entering the code as: > > [t_traj,x_traj] = ode45(@rate_func, t_stamp, [0; 0; 0.0553; 0; 0; 0; 0; 0], [], k2, k3, k4, k5, k6, k7, param); > > but to no avail. I've also tried it a row vector; nothin'. If anyone is able to suggest where I might be going wrong or what may be causing this error, it would be greatly appreciated. I have spent hours trying to solve this. Please message me if it would help to see the complete code. > > Thank you! I don't have a solution, but I'm having the exact same problem
From: Eugene on 4 Dec 2009 03:38 Inside RATE_FUNC are you _returning_ a vector of length eight? I think you have to do that, if you're not. "Kevin Reilly" <kevin.t.reilly(a)gmail.com> wrote in message <hf4kbt$46e$1(a)fred.mathworks.com>... > Hey all, > > I am trying to fit parameters to a kinetic model from experimental data through least squares regression, basically just using fmincon, nothing fancy. I am, however, stuck with an issue; MatLab is telling me: > > ??? Error using ==> odearguments at 116 > Solving RATE_FUNC requires an initial condition vector of length 8. > > The annoying part is that I AM specifying and initial condition vector of length 8: > > t_stamp = param.measured_data(:,1); > x0 = [0; 0; 0.0553; 0; 0; 0; 0; 0]; > > [t_traj,x_traj] = ode45(@rate_func, t_stamp, x0, [], k2, k3, k4, k5, k6, k7, param); > > The variable t_stamp is just taking the time stamps of the measured data points so that the ODE solver returns the function value at those times. The function 'rate_func' contains seven chemical rate equations and eight differential equations; hence why I need an initial condition vector of length 8. The variables k2 to k7 are the parameters that I am varying. > > I have tried even tried entering the code as: > > [t_traj,x_traj] = ode45(@rate_func, t_stamp, [0; 0; 0.0553; 0; 0; 0; 0; 0], [], k2, k3, k4, k5, k6, k7, param); > > but to no avail. I've also tried it a row vector; nothin'. If anyone is able to suggest where I might be going wrong or what may be causing this error, it would be greatly appreciated. I have spent hours trying to solve this. Please message me if it would help to see the complete code. > > Thank you!
From: Kevin Reilly on 4 Dec 2009 03:47 I solved this issue. It turns out I had made a mistake in specifying the output of my function that was being called by the ODE solver. I was trying to pass back a vector with a single element rather than my vector of differential equations. So yes, you are right, I was not returning a vector of length 8. Thanks! "Eugene " <evulfsonREMOVETHIS(a)brandeis.edu> wrote in message <hfahpr$bav$1(a)fred.mathworks.com>... > Inside RATE_FUNC are you _returning_ a vector of length eight? I think you have to do that, if you're not. > > "Kevin Reilly" <kevin.t.reilly(a)gmail.com> wrote in message <hf4kbt$46e$1(a)fred.mathworks.com>... > > Hey all, > > > > I am trying to fit parameters to a kinetic model from experimental data through least squares regression, basically just using fmincon, nothing fancy. I am, however, stuck with an issue; MatLab is telling me: > > > > ??? Error using ==> odearguments at 116 > > Solving RATE_FUNC requires an initial condition vector of length 8. > > > > The annoying part is that I AM specifying and initial condition vector of length 8: > > > > t_stamp = param.measured_data(:,1); > > x0 = [0; 0; 0.0553; 0; 0; 0; 0; 0]; > > > > [t_traj,x_traj] = ode45(@rate_func, t_stamp, x0, [], k2, k3, k4, k5, k6, k7, param); > > > > The variable t_stamp is just taking the time stamps of the measured data points so that the ODE solver returns the function value at those times. The function 'rate_func' contains seven chemical rate equations and eight differential equations; hence why I need an initial condition vector of length 8. The variables k2 to k7 are the parameters that I am varying. > > > > I have tried even tried entering the code as: > > > > [t_traj,x_traj] = ode45(@rate_func, t_stamp, [0; 0; 0.0553; 0; 0; 0; 0; 0], [], k2, k3, k4, k5, k6, k7, param); > > > > but to no avail. I've also tried it a row vector; nothin'. If anyone is able to suggest where I might be going wrong or what may be causing this error, it would be greatly appreciated. I have spent hours trying to solve this. Please message me if it would help to see the complete code. > > > > Thank you!
|
Pages: 1 Prev: how to compare variable precision numbers Next: setting color with data |