Adding members to a matrix changes other members in the matrix

1 view (last 30 days)
Hello,
This is obviously due to my lack of understanding but cna anybody point out what i'm doing wrong here, please?
I've created a vector of odd numbers up to 25:
X = 1:2:2*13
...and then populated the first row of a matrix with that vector:
Y = [X(1:13)]
...which achieves the following:
X =
1 3 5 7 9 11 13 15 17 19 21 23 25
Y =
1 3 5 7 9 11 13 15 17 19 21 23 25
I then modified my script to add a second row to the matrix Y, which uses a function with vector X as its domain:
Y = [X(1:13) ;...
(X(1:13).^3)/factorial(3) ]
...but, when I run the script, the new line descriptor has changed the first line as well:
Y =
1.0e+03 *
Columns 1 through 12
0.0010 0.0030 0.0050 0.0070 0.0090 0.0110 0.0130 0.0150 0.0170 0.0190 0.0210 0.0230
0.0002 0.0045 0.0208 0.0572 0.1215 0.2218 0.3662 0.5625 0.8188 1.1432 1.5435 2.0278
Column 13
0.0250
2.6042
So why has it done that?
There's obviously some sort of link between the two rows, but I can't see the logic or sense in there being one...
Thanks for any help on this,
Paul
  2 Comments
Walter Roberson
Walter Roberson on 13 Sep 2022
The
Y =
1.0e+03 *
means that all values displayed in the matrix need to be mentally multiplied by 1.0e+03 (that is, 1000) . So for exampled 0.0030 needs to be mentally multiplied out to get 3.0 and 0.0208 needs to be mentally multiplied out to get 20.8
This saves presentation space compared to having to put e+03 after the end of every entry, like 0.0030e+03 0.0208e+03 .

Sign in to comment.

Accepted Answer

Bruno Luong
Bruno Luong on 13 Sep 2022
It is simply the display on screen that scale the data to largest value. The data is untouched interally.
  2 Comments
paul
paul on 14 Sep 2022
Moved: Bruno Luong on 14 Sep 2022
Thankyou both, that's very helpful.
I like matlab but, my goodness me, it keeps tripping me up!
Thanks for your help,
Paul

Sign in to comment.

More Answers (0)

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!