How to round a symbolic value to 1 decimal place?
Show older comments
The error I keep getting:
"Error using sym/round Too many input arguments."
How: I am trying to do simultaneous equations with two matrices with symbolic values J,K, and L (and others) like so:
disp('The problem is to find what fraction of groups g_1 g_2 and g_3 are required to create the optimal "TARGET"')
syms J K L g_1 g_2 g_3 traget TARGET p_1 p_2 p_3 Grp tGrp invtGrp Tar tTar
disp('Given:')
g_1 = 0.1*J + 0.2*K + 0.7*L
g_2 = 0.2*J + 0.6*K + 0.2*L
g_3 = 0.8*J + 0.1*K + 0.1*L
traget = 0.2*J + 0.4*K + 0.4*L
disp('In order to solve the problem:')
TARGET = p_1*g_1 + p_2*g_2 + p_3*g_3
disp('Transform "g_1, g_2 & g_3" and "Target" into matrix form:')
Grp = [0.1*J 0.2*K 0.7*L ; 0.2*J 0.6*K 0.2*L ; 0.8*J 0.1*K 0.1*L] %%The matrix from the sources
Tar = [0.2*J 0.4*K 0.4*L] %%The matrix for the required mix
disp('In order to find p_1 p_2 and p_3, I need to transpose and put these matrices into " A*x = B " form')
tGrp = transpose(Grp)
unknowns = [p_1 ; p_2 ; p_3]
tTar = transpose(Tar)
disp('Therefore transpose(S)*(p_1 p_2 p_3)= transpose(M) ,and therefore inv(transpose(S))*transpose(M)=(p_1 p_2 p_3)')
invtGrp = inv(transpose(Grp))
Fractions = invtGrp*tTar
Temp = invtGrp*tTar*100;
round(Temp,1) %%ERROR This should round the three values in the 3x1 matrix to one decimal place, BUT I keep getting the error above.
Thank you for your help.
Accepted Answer
More Answers (0)
Categories
Find more on Formula Manipulation and Simplification in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!