How to pull out the data from struct with fields

2 vues (au cours des 30 derniers jours)
Soungeon Park
Soungeon Park le 14 Nov 2019
Commenté : Soungeon Park le 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?

Réponse acceptée

Philippe Lebel
Philippe Lebel le 14 Nov 2019
Modifié(e) : Philippe Lebel le 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:

Plus de réponses (0)

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by