Plot ratio of 2 timeseries data on MATLAB

5 visualizaciones (últimos 30 días)
Syed Muhammad Abdullah
Syed Muhammad Abdullah el 18 de Sept. de 2019
Respondida: Jesús Zambrano el 6 de Feb. de 2020
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 comentarios
Ankit
Ankit el 20 de Sept. de 2019
normally it should work. Is it possible to upload your data as *.mat file?
thoughtGarden
thoughtGarden el 20 de Sept. de 2019
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);

Iniciar sesión para comentar.

Respuestas (1)

Jesús Zambrano
Jesús Zambrano el 6 de Feb. de 2020
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

Categorías

Más información sobre Time Series en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by