Change X axis units

23 ビュー (過去 30 日間)
Laura Ferrer Pascual
Laura Ferrer Pascual 2020 年 11 月 6 日
コメント済み: Steven Lord 2020 年 11 月 6 日
Hi!
I was given some data where Y axis is in uV and X axis in seconds. I want to change both units to mV and to hours.
My problem is that the data is "loaded" to my matlab code, for instance:
s1=load('data.txt');
So I don't know how to change the units.

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 11 月 6 日
In the following example, I assumed that 1st column in data.txt is x-values and 2nd column is y-values
s1 = load('data.txt');
t = s1(:,1);
uV = s1(:,2);
t_hour = t/3600;
mV = uV/1000;
plot(t_hour, mV)
  8 件のコメント
Laura Ferrer Pascual
Laura Ferrer Pascual 2020 年 11 月 6 日
Yes! First column is s and second column is uV
Ameer Hamza
Ameer Hamza 2020 年 11 月 6 日
In that case, the unit of RE and TE are also uV. Consequently, the unit of O is also uV. The last code in my comment should work.

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

その他の回答 (1 件)

KSSV
KSSV 2020 年 11 月 6 日
To convert seconds to hours multiply t by
t_in_hours = t_in_seconds*1/(60*60) ;
To convert uV to mV, multiply v by
V_in_mV = V_in_uV*1/1000 ;
  1 件のコメント
Steven Lord
Steven Lord 2020 年 11 月 6 日
To make the time conversion a bit more self-explanatory in the code you can use the seconds and hours functions.
>> s = 7200;
>> h = hours(seconds(s))
h =
2
Another example: a million minutes is a little under 2 years.
>> years(minutes(1e6))
ans =
1.90132431040869
There's also a days function you can use for this purpose.

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

カテゴリ

Help Center および File ExchangeDiscrete Data Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by