error in multiplication of array by a number

Hello, I have a question, I have array X that has 3352 numbers in it and i am trying to multiply every number by 3017.4. And its not going well.
These are the last 2 numbers of array 0.2204 0.1897. After I write x1=x*3017.4 it returns new array x1 and in it the last 2 numbers look like this 0.6650 0.5723.
And I dont get why it is doing this, and it is happening to all numbers in that array, I even tried to multiply by 1000 and 3 in kinda works but not completely. If I multiply it by 1000 it calculates correctly those last numbers 220.3920 189.6600 but then i multiply it by 3 it jumps back to 0.6650 0.5723.
I really want to know how to multiply it please help me, if thats my mistake or some matlab smart thingie.

6 Comments

How did you check the last number?
x(end)
Can you upload the data (in a *.mat file) and your code (in a *.m file)?
Could you please share your code? Thanks
I am sorry guys i am not doing that in function i am just putting that to command window
I am like x=[ctrl + v] and i copy all of my nubmers into that
then i am like x1=x*3000 and then i display x1 and those numbers i just multiplayed by 3 but not that 1000 si then i go like x1=x1*1000 but nothing happens, stil the same numbers. That dot inside my number is not moving
I will show you example my last number in array is 0.605 then i make that x1=x1*1000 and then I display x1 and the last number is still 0.605. That dot didint move
Look at the exponent displayed on top of the result when you display the result.
>> a=rand(1,10)
a =
0.0975 0.2785 0.5469 0.9575 0.9649 0.1576 0.9706 0.9572 0.4854 0.8003
>> a*1e6
ans =
1.0e+05 * % <====== THIS THING, is a common exponent of on numbers bellow
0.9754 2.7850 5.4688 9.5751 9.6489 1.5761 9.7059 9.5717 4.8538 8.0028
>>
my data is so long that i cant even see the beginning, but I have been looking for this but didint see it so I asked here we when i plotted it those numbers are in thousands so thanks a lot guys, love you

Sign in to comment.

Answers (1)

Just a guess here. If you have
x = [0.2204 0.1897]
and then type
1000*x
in the command window, it will display [220.4 189.7], but it does not change the value of x. So, if you were to now do
3*x
you will get [0.6612 0.5691].
If you wanted to multiply x by 1000, you need
x = 1000*x

5 Comments

This is what it looks like, the first image is just the end of my data then the second is the code i am putting in and the third is the result. I even tried to multiply it as you said x3 and then x1000 butit doesnt work
When i multiply it by 1000 its moves its ok (0,605=605), but then i multiply it by 3 and then it jumpes back to 1,815
My best guess now is that way at the top of the display of that vector, there is a multiplier that looks like this:
but you are not seeing it (and it is not in your screenshot) because you are only looking at the bottom of the display.
Scroll up to the top of the display of the vector, and I'm guessing you'll see it.
my data is so long that i cant even see the beginning, but I have been looking for this but didint see it so I asked here we when i plotted it those numbers are in thousands so thanks a lot guys, love you
Oh, I just noticed Bruno mentioned the same thing in a comment above. I will still take credit for independent discovery. :-)
No problem I give you all credit you want Mr cyclist.

Sign in to comment.

Categories

Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange

Asked:

on 28 Jul 2020

Edited:

on 28 Jul 2020

Community Treasure Hunt

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

Start Hunting!