# HG changeset patch # User danieleb@code.soundsoftware.ac.uk # Date 1308133563 -3600 # Node ID ee2a86d7ec0732d8341898e9fd1f010a3156f99b # Parent e124001d2437f76523e4f0271985650f5afcc5f6 Added support functions diff -r e124001d2437 -r ee2a86d7ec07 .hgignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Wed Jun 15 11:26:03 2011 +0100 @@ -0,0 +1,1 @@ +lappedorthobasis\.m~ diff -r e124001d2437 -r ee2a86d7ec07 l1overl2.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/l1overl2.m Wed Jun 15 11:26:03 2011 +0100 @@ -0,0 +1,33 @@ +function z = l1overl2(X) +%L1OVERL2 ratio between the l1 and the l2 norms. +% +% z = l1overl2(X) +% +% computes the ratio between the l1 and the l2 norm of the input X. If +% input is a matrix, the norms are calculated along the columns and a mean +% value is returned. If the input is a cell, the norms are calculated +% independently for each cell entry and a mean value is returned. +% +% ----------------------------------------------------------- % +% Daniele Barchiesi, daniele.barchiesi@eecs.qmul.ac.uk % +% Centre for Digital Music, Queen Mary University of London % +% Apr. 2011 % +% ----------------------------------------------------------- % +if iscell(X) + nCols = length(X); + z = zeros(nCols,1); + for i=1:nCols + z(i) = norm(X{:,i},1)/norm(X{:,i},2); + end +else + nCols = size(X,2); + z = zeros(nCols,1); + for i=1:nCols + z(i) = norm(X(:,i),1)/norm(X(:,i),2); + end +end + +z(isnan(z)) = []; +z = mean(z); + +%EOF \ No newline at end of file diff -r e124001d2437 -r ee2a86d7ec07 lappedorthobasis.m --- a/lappedorthobasis.m Tue Jun 14 15:52:47 2011 +0100 +++ b/lappedorthobasis.m Wed Jun 15 11:26:03 2011 +0100 @@ -77,7 +77,7 @@ %last frame g = lappedwindow(wLength(end),tailLength,tailFunc,'last'); if strcmpi(orthobasis,'mdct') - orthoMat = dctmatrix(wLength(end),[],'I'); + orthoMat = dcti(eye(wLength(end)),'I'); else orthoMat = basisFun(eye(wLength(end))); end diff -r e124001d2437 -r ee2a86d7ec07 mag2db.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mag2db.m Wed Jun 15 11:26:03 2011 +0100 @@ -0,0 +1,2 @@ +function y = mag2db(x) +y = 20*log10(x); \ No newline at end of file diff -r e124001d2437 -r ee2a86d7ec07 normcol.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/normcol.m Wed Jun 15 11:26:03 2011 +0100 @@ -0,0 +1,15 @@ +function [x n] = normcol(x) +%NORMCOL normalise the columns to unit length +% +% [x n] = normcol(x) +% +% normalises the columns of the input matrix x and returns a vector n +% containing the initial norm of the columns. +% +% ----------------------------------------------------------- % +% Daniele Barchiesi, daniele.barchiesi@eecs.qmul.ac.uk % +% Centre for Digital Music, Queen Mary University of London % +% Apr. 2011 % +% ----------------------------------------------------------- % +n = sqrt(sum(conj(x).*x,1)); +x = x*diag(1./n); \ No newline at end of file