In Matlab, how to use variables for numbers in scientific notation (matissa and exponent)?

I am using Matlab and using numbers in scientific notation which are represented by a letter e

for an exponent. Example in Matlab:

>> 2e5
ans =
200000

      

Now we would like to work with numbers in scientific notation, but using variables to store the values ​​of the mantissa and exponent (respectively to the left and right of e

). I don't understand how this can be done without merging the variable names with the letter e

for the exponent. For example:

>> rr=5;
>> 2err
??? 2err
|
Error: Unexpected MATLAB operator.

      

Can this be done? Or should I use the manual approach:

>> 2*10^rr
ans =
200000

      

+3


source to share


1 answer


You must use a manual approach; you cannot use this kind of scientific notation with variables. You can use 2.*10.^rr

with .

so that you can use the same operator with arrays of numbers.



+3


source







All Articles