Converting 1d signal to 2d image
22 views (last 30 days)
Show older comments
Kamila Jankowska on 15 Dec 2022
Answered: Image Analyst on 15 Dec 2022
I would like to ask how can I convert 1d signal to timeseries image, which will be used as CNN input?
Atatched schema is presenting this operation.
Abderrahim. B on 15 Dec 2022
If i understood your question properly, you want to convert time series (signal is type of time series) to like-image to train CNN. See below:
% Generate signal
Fs = 2500 ;
F = [40 70 400]
t = 0:1/Fs:2-1/Fs ; % 2 seconds
noisySig = 2.5*sum(cos(2*pi*F.'*t)) + randn(1, length(t)) ; % noisy signal
% convert to spectrogram
hope this helps
How about using reshape to make it into a 2-D matrix of the proper aspect ratio? Then use imresize to size it to the size your network requires. Like to get 227 rows from your signal:
reshapedSignal = reshape(originalSignal, 227, );
reshapedSignal = imresize(reshapedSignal, [227, 227]); % 227 for Alexnet
Find more on Descriptive Statistics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!