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

finding the power of a number

Asked by Ekta Shah on 22 Jun 2013

hello, actually what i wanted to know is: if i have a number like 0.6543e+013. Now i just need 0.6543.so i need to divide by 10^the power.but i cant understand how to find this value of power.Is there any function available in matlab that can give me my value...?

Thank you, Ekta

0 Comments

Ekta Shah

Products

No products are associated with this question.

3 Answers

Answer by Azzi Abdelmalek on 22 Jun 2013
Edited by Azzi Abdelmalek on 22 Jun 2013
Accepted answer
a=0.6543e+013 
power=ceil(log10(a)-1)
b=10^(log10(a)-power)

% the result b is always between 1 and 10, if you want the result to be between 0 and 1 add

power=power+1
b=b/10

1 Comment

Ekta Shah on 23 Jun 2013

Thanks a lot.My problem is sorted.

Azzi Abdelmalek
Answer by Andrei Bobrov on 22 Jun 2013
x = 0.6543e+013
x*10^-ceil(log10(x))

0 Comments

Andrei Bobrov
Answer by Jan Simon on 23 Jun 2013

What is the wanted result for:

123.456
0.0000000000123

0 Comments

Jan Simon

Contact us