How do I plot time series for multiple machines.

I am trying to trend and compare temperatures on multiple wind turbines. I am currently only selecting one temperature output with 10 minute values for 46 machines. I have imported the data as three columns, A is the turbine number, B is the date and time, C is the temperature value.

回答(2 个)

Using timetasbles in 16b,
>> Temp = 60+ 20*randn(30,1);
>> Turbine = categorical(repelem({'A';'B';'C'},10));
>> Date = repmat(datetime(2017,4,(1:10)'),3,1);
>> tt = timetable(Date,Turbine,Temp)
tt =
30×2 timetable
Date Turbine Temp
___________ _______ ______
01-Apr-2017 A 71.623
02-Apr-2017 A 16.151
03-Apr-2017 A 13.614
[snip]
09-Apr-2017 C 67.999
10-Apr-2017 C 41.401
>> tt = unstack(tt,'Temp','Turbine')
tt =
10×3 timetable
Date A B C
___________ ______ ______ ______
01-Apr-2017 35.743 78.497 46.969
02-Apr-2017 61.324 60.001 83.842
03-Apr-2017 73.047 58.902 27.763
04-Apr-2017 66.541 78.223 59.511
05-Apr-2017 81.653 71.892 21.023
06-Apr-2017 80.122 67.004 80.41
07-Apr-2017 46.982 85.005 77.234
08-Apr-2017 65.141 78.596 60.023
09-Apr-2017 41.112 64.795 58.583
10-Apr-2017 33.564 46.193 10.274
Then using plot (output attached)
plot(tt.Date,tt.Variables);
legend(tt.Properties.VariableNames);
or using ttplot from the File Exchange (output attached)
ttplot(tt);
Prior to 16b, you could do all that with a table (pass 'ContatntVar','Date' into unstack, and use t{:,{'A' 'B' 'C'}} instead of tt.Variables), but timetables offer advantages when you need to do more than plotting.
What's wrong with
plot(B, A);
C is constant since you said you were taking/viewing "one temperature output".
? If not, then look at the plot gallery: https://www.mathworks.com/products/matlab/plot-gallery.html for other visualizations that you may prefer.

类别

帮助中心File Exchange 中查找有关 Wind Power 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by