How to pull out the data from struct with fields

7 views (last 30 days)
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?

Accepted Answer

Philippe Lebel
Philippe Lebel on 14 Nov 2019
Edited: Philippe Lebel on 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:

More Answers (0)

Community Treasure Hunt

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

Start Hunting!