Converting 1d signal to 2d image
32 次查看(过去 30 天)
显示 更早的评论
Hello,
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.
0 个评论
回答(2 个)
Abderrahim. B
2022-12-15
Hello!
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
spectrogram(noisySig, Fs)
hope this helps
1 个评论
Image Analyst
2022-12-15
Image Analyst
2022-12-15
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
2 个评论
PRASANTA KUMAR MOHANTY
2023-7-25
Dear Image Analyst,
Will the reshaping of the original signal retain the all the information of the original one?
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Convert Image Type 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!