Plot ratio of 2 timeseries data on MATLAB

조회 수: 14 (최근 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 CenterFile Exchange에서 Time Series에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by