Mercurial > hg > lots
view lotplot.m @ 9:df83493c1669
more efficient implementation of DCT-I
author | danieleb@code.soundsoftware.ac.uk |
---|---|
date | Mon, 20 Jun 2011 15:26:07 +0100 |
parents | e2a029a70df3 |
children | 2e42f5fb764d |
line wrap: on
line source
function varargout = lotplot(y,wLength,Fs) % LOTPLOT plot of the lapped orthogonal transform % % varargout = lappedorthoplot(y,wLength,timeVec) % % plots a spectrogram-like visualisation of the lapped orthogonal % transform coefficients contained in y % % INPUT: % - y: vector containing the lapped orthogonal transform coefficients % - wLength: vector containing the lengths of the overlapping windows % - Fs: (optional, default=44100) sampling frequency % % OUTPUT: % - varargout{1}: optionally, the function outputs the matrix containing % the spectrogram-like representation. % % SEE ALSO % lot, ilot % if ~exist('Fs','var') || isempty(Fs), Fs = 44100; end if isscalar(wLength) %create vector of fixed window lengths nWindows = floor(length(y)/wLength); wLength = wLength*ones(nWindows,1); end nWindows = length(wLength); maxLength = max(wLength); sigLength = sum(wLength); timeVec = linspace(0,sigLength/Fs,10*ceil(sigLength/min(wLength))); S = zeros(maxLength,length(timeVec)); timeSupp = @(p) floor(wLength(p)*length(timeVec)/sigLength); interpFun = @(p,v) interp1(1:wLength(p),abs(v),linspace(1,wLength(p),maxLength))'; S(:,1:timeSupp(1)) = repmat(interpFun(1,y(1:wLength(1))),1,timeSupp(1)); for i=2:nWindows S(:,sum(timeSupp(1:i-1))+(1:timeSupp(i))) = ... repmat(interpFun(i,y(sum(wLength(1:i-1))+(1:wLength(i)))),1,timeSupp(i)); end SmagdB = mag2db(S); if nargout, varargout{1} = SmagdB; end surf(timeVec,1:maxLength,SmagdB,'EdgeColor','none'); axis xy; axis tight; colormap(jet); view(0,90); set(gca,'YScale','log');