Plot ratio of 2 timeseries data on MATLAB

8 ビュー (過去 30 日間)
Syed Muhammad Abdullah
Syed Muhammad Abdullah 2019 年 9 月 18 日
回答済み: Jesús Zambrano 2020 年 2 月 6 日
Hi, I'm in the process of creating a plot of a variable Pr = Pideal/Pchange, whereas 'Pideal' are the timeseries values of ideal power output and Pchange are timeseries values of powerout subject to certain outage. Now as I do Pr = Pideal/Pchange, The MATLAB gives me an error. Here a1=zb1/z1 is the same as Pr = Pideal/Pchange.for plotting I just write plot (a1); I'm a beginner. Appreciate the help.
m2.PNG
m3.PNG
  2 件のコメント
Ankit
Ankit 2019 年 9 月 20 日
normally it should work. Is it possible to upload your data as *.mat file?
thoughtGarden
thoughtGarden 2019 年 9 月 20 日
Just confirmed that in general, this should work:
timeS1 = timeseries(linspace(1,2));
timeS2 = timeseries(linspace(1,5));
timeS1/timeS2
timeseries
Common Properties:
Name: 'unnamed'
Time: [100x1 double]
TimeInfo: [1x1 tsdata.timemetadata]
Data: [1x1x100 double]
DataInfo: [1x1 tsdata.datametadata]
More properties, Methods
though it is possible your timeseries are not the same length
timeS1 = timeseries(linspace(1,2));
timeS2 = timeseries(linspace(1,5,50));
timeS1/timeS2
Error using timeseries/utArithCommonTime (line 9)
Time series lengths are mismatched.
Error in timeseries/mrdivide>localmrdivide (line 58)
[commomTimeVector,outprops,warningFlag] = utArithCommonTime(ts1,ts2);
Error in / (line 26)
tsout = localmrdivide(ts1,ts2);

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

回答 (1 件)

Jesús Zambrano
Jesús Zambrano 2020 年 2 月 6 日
Hi Syed,
If you want to divide two vectors, use ./ command instead of / command.
This will do the division element-by-element. The two vectors should have the same size.
You can get more information by typing the following in the command window:
help ./
Best,
Jesús

カテゴリ

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

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by