Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Round coefficients of symbols

Asked by Brian on 19 Jun 2013

I have a solution matrix with equations and coefficients in front of symbols. I want to round them to a certain decimal.

example: X=[1.89545464564*S+0.00000085*M, 1.00000055*S-0.68129354234*M; 0.00000000345*S+0.00000346*M, 1.00004353*S+1.68129354234*M];

How to round the coefficients that are in front of S and M in my matrix to something like 2 or 3 decimal places.

Thank you!

0 Comments

Brian

Products

No products are associated with this question.

1 Answer

Answer by Andrei Bobrov on 19 Jun 2013
syms M S
 X=[1.89545464564*S+0.00000085*M, 1.00000055*S-0.68129354234*M; 0.00000000345*S+0.00000346*M, 1.00004353*S+1.68129354234*M];
out = vpa(X,4);

0 Comments

Andrei Bobrov

Contact us