How can I use fmincon to solve problems with ODEs

2 views (last 30 days)
I would like to use fmincon to analytically find the maximum lateral acceleration acheivable by a car, modeled using the single track bicycle model. I've solved simple problems with linear equations using fmincon (max surface area of a cube) but this one is over my head because one of the equations is an ODE.
The 2 Degree of Freedom (DOF) bicycle model is widely used as a simplified model of a car, used to study lateral dynamics.
The inputs to the simple 2 DOF model are the steering angle (df) and the longitudinal velocity (vx).
Using some constants to describe the car and the tires,
a, b and Iz = geometric constants
m = car mass = constant
Cyf and Cyr = cornering stiffnesses = constants
The car's lateral acceleration is modeled by,
vy_dot = (Fyf/m)*cos(df) + Fyr/m - vx*r;
where,
Fyf = Cyf * Af;
Fyr = Cyr * Ar;
and,
Af = (vy + a*r)/vx - df;
Ar = (vy - b*r)/vx
The car's yaw acceleration is modeled by,
r_dot = time derivative of yaw velocity r = (a/Iz)*Fyf*cos(df) - (b/Iz)*Fyr;
So it would all be simple for me to maximize vy_dot using fmincon if r was not the integral of r_dot. I simply don't know how to represent this r_dot = d/dt (r) in the functions for fmincon.
Thanks in advance for your help!

Answers (1)

J. Alex Lee
J. Alex Lee on 4 Aug 2020
I presume you mean to use r at some specific time, where r(0) (or some other time) is known - a standard 1D ODE.
with some initial condition, so either see if your r_dot expression is analytically integrable, or integrate it numerically.
Look into "integral" or "ode45".
  1 Comment
Justin Taylor
Justin Taylor on 6 Aug 2020
Yes perhaps I can use ode45 (or variant) in the ceq portion of the nonl argument. I'll give it a go, thanks!

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!