how to save spectrogram of signal as image ? i have given my code.

조회 수: 8 (최근 30일)
x=train_data(91,:,1); N = 1000; fs=250; t=(1:N)/fs; Fn=fs/2; Wp = [8 30]/Fn; % Passband Frequency (Normalised) Ws = [7.8 31]/Fn; % Stopband Frequency (Normalised) Rp = 1; % Passband Ripple (dB) Rs = 150; % Stopband Ripple (dB) [n,Ws] = cheb2ord(Wp,Ws,Rp,Rs); % Filter Order [z,p,k] = cheby2(n,Rs,Ws); % Filter Design [sosbp,gbp] = zp2sos(z,p,k); % Filter Signal filtered_signal = filtfilt(sosbp, gbp,x); Z1=filtered_signal; figure spectrogram(Z1,128,120,128,fs,'yaxis') title('SPECTROGRAM of MOTOR IMAGERY EEG SIGNAL CHANNEL C3')

채택된 답변

KALYAN ACHARJYA
KALYAN ACHARJYA 2018년 9월 10일
편집: KALYAN ACHARJYA 2018년 9월 10일
x=train_data(91,:,1);
N=1000;
fs=250;
t=(1:N)/fs;
Fn=fs/2;
Wp=[8 30]/Fn; % Passband Frequency (Normalised)
Ws=[7.8 31]/Fn; %Stopband Frequency (Normalised)
Rp=1; % Passband Ripple (dB)
Rs=150; % Stopband Ripple (dB)
[n,Ws]=cheb2ord(Wp,Ws,Rp,Rs); % Filter Order
[z,p,k]=cheby2(n,Rs,Ws); % Filter Design
[sosbp,gbp]=zp2sos(z,p,k);
%Filter Signal
filtered_signal=filtfilt(sosbp, gbp,x);
Z1=filtered_signal;
figure spectrogram(Z1,128,120,128,fs,'yaxis')
title('SPECTROGRAM of MOTOR IMAGERY EEG SIGNAL CHANNEL C3');
saveas(gcf,'filename.png'); %Use to display save as image
  댓글 수: 2
Sylvain Boutros
Sylvain Boutros 2020년 5월 19일
Is there a way to saveas with specific size? I've got melspecs that are generated 656x875 and I was wondering how I could save them using saveas to about 256x256?
Mihir Pingle
Mihir Pingle 2021년 2월 19일
imwrite(imresize(im,[227,227]),filename)
use this command

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Time-Frequency Analysis에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by