How to pull out the data from struct with fields
Show older comments
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
More Answers (0)
Categories
Find more on Conversion in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!