comparison lotplot.m @ 17:0da5eb32e49d tip

minor changes
author Daniele Barchiesi <daniele.barchiesi@eecs.qmul.ac.uk>
date Thu, 10 Nov 2011 15:53:06 +0000
parents 2e42f5fb764d
children
comparison
equal deleted inserted replaced
16:ce97f3e920ef 17:0da5eb32e49d
29 29
30 nWindows = length(wLength); 30 nWindows = length(wLength);
31 maxLength = max(wLength); 31 maxLength = max(wLength);
32 sigLength = sum(wLength); 32 sigLength = sum(wLength);
33 33
34 timeVec = linspace(0,sigLength/Fs,10*ceil(sigLength/min(wLength))); 34 timeVec = linspace(0,sigLength/Fs,nWindows);
35 35
36 S = zeros(maxLength,length(timeVec)); 36 S = zeros(maxLength,nWindows);
37 timeSupp = @(p) floor(wLength(p)*length(timeVec)/sigLength); 37 timeSupp = @(p) floor(wLength(p)*length(timeVec)/sigLength);
38 interpFun = @(p,v) interp1(1:wLength(p),abs(v),linspace(1,wLength(p),maxLength))'; 38 interpFun = @(p,v) interp1(1:wLength(p),abs(v),linspace(1,wLength(p),maxLength))';
39 S(:,1:timeSupp(1)) = repmat(interpFun(1,y(1:wLength(1))),1,timeSupp(1)); 39 S(:,1) = repmat(interpFun(1,y(1:wLength(1))),1,1);
40 for i=2:nWindows 40 for i=2:nWindows
41 S(:,sum(timeSupp(1:i-1))+(1:timeSupp(i))) = ... 41 S(:,i) = ...
42 repmat(interpFun(i,y(sum(wLength(1:i-1))+(1:wLength(i)))),1,timeSupp(i)); 42 mag2db(repmat(interpFun(i,y(sum(wLength(1:i-1))+(1:wLength(i)))),1,1));
43 end 43 end
44 44
45 SmagdB = mag2db(S); 45 if nargout, varargout{1} = S; end
46 if nargout, varargout{1} = SmagdB; end
47 46
48 surf(timeVec,1:maxLength,SmagdB,'EdgeColor','none'); 47 surf(timeVec,(1:maxLength)/maxLength*Fs/2,S,'EdgeColor','none');
49 axis xy; axis tight; 48 axis xy; axis tight;
50 colormap(jet); 49 colormap(jet);
51 view(0,90); 50 view(0,90);
52 set(gca,'YScale','log'); 51 set(gca,'YScale','log');
52 xlabel('time (sec)');
53 ylabel('frequency (Hz)');