# HG changeset patch # User samer # Date 1358429539 0 # Node ID 1eb0ea29ec40ef21652af151adb4732eba831d8f # Parent b1399f66b364d04461a2521080ee35e0fc26195f Doesn't belong here. diff -r b1399f66b364 -r 1eb0ea29ec40 general/numerical/mse.m --- a/general/numerical/mse.m Thu Jan 17 13:24:01 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -function E=mse(x1,x2) -% mse - Mean-square diff between arrays. -% -% mse :: [[Size]], [[Size]] -> nonneg. - -E=mean(flatten((x1-x2).^2)); - - - diff -r b1399f66b364 -r 1eb0ea29ec40 general/numerical/quantile.m --- a/general/numerical/quantile.m Thu Jan 17 13:24:01 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -function Y=quantile(Q,X) -% quantile - compute quantiles of X -% -% quantile :: -% [[L]->0--1] ~'the L quantiles to compute', -% [[N,M]] ~'M columns of data' -% -> [[L,M]] ~'the L quantiles for each of M columns'. - -j=max(1,round(Q*size(X,1))); -S=sort(X); -Y=S(j,:); - - diff -r b1399f66b364 -r 1eb0ea29ec40 general/numerical/smooth_with.m --- a/general/numerical/smooth_with.m Thu Jan 17 13:24:01 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -function Z=smooth_with(h,i,Y) -% smooth_with - Smooth a signal by convolution without changing length -% -% smooth_with :: [[M]], 1..M, [[N]] -> [[N]]. - -m=length(h); -h=stoch(h(:))'; -csh=cumsum(h); -rsh=fliplr(cumsum(fliplr(h))); - -if isvector(Y), Z=sm(Y); -else Z=maprows(@sm,Y); -end - -function z=sm(y) - z=conv(h,y); % complete convolution - z=z(i:end-(m-i)); % trim the ends - - % rescale end bits - z(1:m-i)=z(1:m-i)./csh(i:end-1); - z(end-i+2:end)=z(end-i+2:end)./rsh(2:i); -end - -end diff -r b1399f66b364 -r 1eb0ea29ec40 general/numerical/stddevs.m --- a/general/numerical/stddevs.m Thu Jan 17 13:24:01 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -function Y=stddevs(Q,X) -% stddevs - returns values a certain number of standard deviations from mean -% -% stddevs :: [[L]], [[N,M]] -> [[L,M]]. - -Y=Q(:)*std(X) + repmat(mean(X),length(Q),1);