Matlab

Moderators: None (Apply to moderate this forum)
Number of threads: 1471
Number of posts: 2147

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
weird spectrogram result Posted by afgenovese on 16 Nov 2012 at 7:40 AM
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:

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

Attachment: Capture.PNG (81280 Bytes | downloaded 15 times)



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.