Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

weird spectrogram result

afgenoveseafgenovese Posts: 1Member
Hello, im trying to produce spectrograms but I am only getting quite weid results and I dont know how to make it look nice (full coloured frequency bands)


the code is:
[code]

function [] = fft_comparison( signal1, signal2, name, FS )

error(nargchk(2,4,nargin));

if (nargin < 4)
FS = 48000;
end
if (nargin < 3)
name = 'FFt comparison';
end

signal1_L = signal1(:,1);
signal1_R = signal1(:,2);
signal2_L = signal2(:,1);
signal2_R = signal2(:,2);


%% fft

left1 = fft(signal1_L);
right1 = fft(signal1_R);
left2 = fft(signal2_L);
right2 = fft(signal2_R);

nfft1 = 2^nextpow2(length(signal1));
nfft2 = 2^nextpow2(length(signal2));

%% plot


% figure('name', name);


subplot(2,2,1)
spectrogram(signal1_L,hann(1024),512,nfft1,FS,'yaxis');
title('Original left signal');
subplot(2,2,3)
spectrogram(signal2_L,hann(1024),512,nfft1,FS,'yaxis');
title('Modified left signal');
subplot(2,2,2)
spectrogram(signal1_R,hann(1024),512,nfft1,FS,'yaxis');
title('Original right signal');
subplot(2,2,4)
spectrogram(signal2_R,hann(1024),512,nfft1,FS,'yaxis');
title('Modified right signal');


end[/code]
Sign In or Register to comment.