Displaying the elements of an array

41 ビュー (過去 30 日間)
mu10
mu10 2018 年 2 月 24 日
コメント済み: mu10 2018 年 2 月 24 日
Hi,
I have a problem with displaying the elements of an array. I try 2 approaches and getting 2 different results for the same thing. I have these variables and the loop
ext_freq = 640e6;
sim = 1 / ext_freq;
period = 4500e-9;
time1 = 0:sim:period;
When I say
disp(time1)
the last 4 elements of the array are
Columns 2878 through 2881
0.4495 0.4497 0.4498 0.4500
But when I say
disp(time1(2881))
I got
4.5000e-06
I tried simpler arrays with the same logic and got the same results unlike here. I'd appreciate if you can explain me why there is such a difference here.
Thanks.

採用された回答

Walter Roberson
Walter Roberson 2018 年 2 月 24 日
Look at the very beginning of the display. You will almost certainly see something like
1.0e-5 *
which is a scaling factor that is being applied to the entire display.
To avoid this, give the command
format long g
  1 件のコメント
mu10
mu10 2018 年 2 月 24 日
Yes, I missed that line. Thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWhos についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by