how do i present the variable W with the 2 digits after the decimal point?

i=0.15; v=24;
c=25*10^-6;
R=140; L=260*10^-3;
syms W
eqn = i==v/sqrt((R^2)+(W*L-1/W*c)^2);
W = solve(eqn,W);
w= round(W)

Réponses (1)

format bank
w

5 commentaires

BEFORE DISPLAYING YOUR RESULT, use format bank command
didnt work for me matlab returns W =
(500*3^(1/2)*5^(1/2))/13 + 6000000026^(1/2)/520
(500*3^(1/2)*5^(1/2))/13 - 6000000026^(1/2)/520
6000000026^(1/2)/520 - (500*3^(1/2)*5^(1/2))/13
- (500*3^(1/2)*5^(1/2))/13 - 6000000026^(1/2)/520
what shell i do?
You may use as well
sprintf('%.2f', W);
>> w=1.2345
w =
1.2345
>> sprintf('%.2f',w)
ans =
1.23
>>
double() the symbolic number to get floating point.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by