How to pull out the data from struct with fields
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Soungeon Park
il 14 Nov 2019
Commentato: Soungeon Park
il 14 Nov 2019
R = 250; %[m]
v_CG = (100*1000)/3600; %[m/s] converted from [km/h]
m = 1400; %[kg]
l = 2.6; %[m]
l_r = 0.6*2.6; %[m]
l_f = 0.4*2.6;
C_ar = 40000; %[N/rad]
C_af = 40000; %[N/rad]
%Question set up
a_y = v_CG^2 / R; %Laterial Acceleration
syms a_r a_f
eqns = [C_af*a_f + C_ar*a_r == a_y*m, C_af*a_f*l_f == C_ar*a_r*l_r];
sol = solve(eqns,[a_r,a_f])
a_r = sol.a_r
a_f = sol.a_f
Ths is the code I have. What I'm trying to do is finding values for a_r and a_f using 2 equations.
So the answer I get from above is in fraction form.
a_r =
4750976169402469/109951162777600000
a_f =
14252928508207407/219902325555200000
So whenever I use this values, it gives the value in fraction form but I want to show in decimal form like this.
a_r =
0.0432
a_f =
0.0648
How should I change my code to print out my answer in numbers?
0 Commenti
Risposta accettata
Philippe Lebel
il 14 Nov 2019
Modificato: Philippe Lebel
il 14 Nov 2019
I can't verify my answer because i don't have the required package but try this:
double(a_r)
double(a_f)
i found the info right here:
Più risposte (0)
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!