ode45 - changing parameters & function handle
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Andreas Theocharopoulos
am 21 Dez. 2019
Kommentiert: Andreas Theocharopoulos
am 22 Dez. 2019
I was given a full car model matlab code some time ago and today I decided to use it. The problem is that the code was written for a simple car with contant stiffness and damping throughout the whole suspension travel. I want to change this so that the stiffness and the damping coefficients change based on the values of displacement and velocity produced on previous step of the integration (included in the x output matrix). The solver used is ode45 and the damping-stiffness characteristics are saved together with some other specs concerning each corner of the vehicle on the wheel_1,wheel_2... matrices.
[t,x] = ode45(@FC_Solution_2,tt_f,initial,[],y,y,y,y,tt_f,wheel_1,wheel_2,wheel_3,wheel_4,body,hyst,frtrack,rrtrack,fz,mx,my,fz1,fz2,fz3,fz4);
I tried using the OutputFcn option but just couldn't get it to work, as every example related to this option I found was based on the classic ode45 syntax which I tried to follow but it didn't work.
Is the use of the anonymous function in my case causing the problem? Also I can't really understand why the '[]' is used when calling FC_Solution_2 as the head of this function is the following (23 vs. 22 input arguments):
function dxdt = FC_Solution_2(time,x,y1,y2,y3,y4,tt_f,wheel_1,wheel_2,wheel_3,wheel_4,body,late,frtrack,rrtrack,fz,mx,my,fz1,fz2,fz3,fz4)
Thanks for your time.
1 Kommentar
Akzeptierte Antwort
Walter Roberson
am 21 Dez. 2019
obj = @(time,x) FC_Solution_2(time, x, y, y, y, y, tt_f, wheel_1, wheel_2, wheel_3, wheel_4, body, hyst, frtrack, rrtrack, fz, mx, my, fz1, fz2, fz3, fz4)
[t, x] = ode45(obj, tt_f, initial);
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!