Resampling a Data Array for LSTM Training
显示 更早的评论
Hi,
I am preparing data for training an LSTM network with a sequenceInputLayer. The data is from ANSYS which uses a variable step solver. The time steps in the captured data varying from 1.0E-04 sec to 9.0E-09 sec (average of 5.4E-05 sec). The 4 data sets are imported as approx. 594x7 doubles. I have had help on another post regarding using the interp1 function to help resize the sequences lengths.
My questions is can I resample the data to say 5.0E-05 sec using the resample function? And can the resample function be used on the array as well as a single observation?
I have included the code below as to my progress in using the resample function.
Thanks in advance,
Patrick
%Data Resampling
%Import Chemkin Data from Folder Location - Data captured with Variable Step Solver - Average step size = 5.38E-05
dataraw_03 = xlsread('Data_Ethanol_Raw\export_Ethanol_20%_440t_0.3.csv'); % 574x7 double
dataraw_04 = xlsread('Data_Ethanol_Raw\export_Ethanol_20%_440t_0.4.csv'); % 594x7 double
dataraw_05 = xlsread('Data_Ethanol_Raw\export_Ethanol_20%_440t_0.5.csv'); % 595x7 double
dataraw_06 = xlsread('Data_Ethanol_Raw\export_Ethanol_20%_440t_0.6.csv'); % 596x7 double
%Extract Observations from Array for Resampling
time_03 = dataraw_03(:,1); % Column 1 all rows from first data set
volume_03 = dataraw_03(:,2); % Column 2 all rows from first data set
crankAngle_03 = dataraw_03(:,3); % Column 3 all rows from first data set
temperature_03 = dataraw_03(:,4); % Column 4 all rows from first data set
pressure_03 = dataraw_03(:,5); % Column 5 all rows from first data set
co2_03 = dataraw_03(:,6); % Column 6 all rows from first data set
no_03 = dataraw_03(:,7); % Column 7 all rows from first data set
%Resample Data for LSTM SequenceInputLayer with a target sample rate of 5.0E-05 sec or 20 KHz
timeInterval = 5.0e-5; % Target sample rate [s]
timeInterval_min = 9.0e-8; % Smallest sample rate captured from ANSYS variable rate solver [s]
fs = 1/timeInterval; % Target sample frequency of 20,000 [Hz]
f_down = 1/timeInterval_min; % Downsampling frequency [Hz]
resampledvolume_03 = resample(volume_03,fs,f_down); % Resampled the volume @ 5.0E-05 sec
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 AI for Signals 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!