How to repeat sample data in minutes?
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have 24 hours data sampled in every 5 minutes (using data logger interval every 5 minutes). how i want to repeat my data in every minutes for 24 hours(since my data every 5 minutes).i want to do simulation every 1 minutes for 24 hours.
I'm using matlab 2015.
my example:
%%Import input from actual data
%%import excel data
irr_2016_jan_1 = xlsread('data_2016.xlsx','Jan','CF9:CF296'); % Import data from day 1 january
irr_2016_jan_1 =irr_2016_jan_1'; % transpose data
%%convert data to every minute daily
irr = zeros(1,1381); % create array of zeros for time
for i=1:1:1381
irr(i+5)= irr_2016_jan_1(j)
end
- i try to do it but im stuck here. i need help plz...thanks
1 Kommentar
Antworten (2)
Andrei Bobrov
am 20 Mär. 2018
Bearbeitet: Andrei Bobrov
am 22 Mär. 2018
data = randi(456,288,1); % your data
time = minutes(5:5:1440)';% time of your data
T = timetable(time,data,'v',{'data'});
Tout = retime(T,minutes(0:1440)','linear');
or
last row of code:
Tout = retime(T,minutes(0:1440)','next');
ADDED [MATLAB R2015]
data = randi(456,288,1); % your data
time1 = (5:5:1440)';
time2 = (1:1440)';
F = griddedInterpolant(time1,data,'linear','linear');
T_out = array2table([time2, F(time2)],'v',{'Time','Data'});
or
ii = (1:1440)';
idx = ceil(ii/5);
time2 = (1:1440)';
T_out2 = array2table([time2,data(idx)],'v',{'Time','Data'});
0 Kommentare
KL
am 20 Mär. 2018
Your variable name looks like you're working with irradiation, in that case I wouldn'r recommend interpolation for your simulation. You should rather get data with 1-minute resolution. If you simply want to repeat the same value 5 times, here is an example,
%create a dummy variable A
>> A = (1:5).'
A =
1
2
3
4
5
%now do the repmat and reshape
>> AA = reshape(repmat(A,1,5).',[],1)
AA =
1
1
1
1
1
2
2
2
2
2
3
3
3
...
2 Kommentare
Siehe auch
Kategorien
Mehr zu Multirate Signal Processing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!