I'm trying to run this function like this: calcSQNRA(0,4,6) and I'm getting these errors:
??? Error using ==> mtimes Inner matrix dimensions must agree.
Error in ==> calcSQNRA>@(x)x.^2*e.^(-x) at 6 f = @(x) x.^2 * e.^(-x);
Error in ==> quadl at 70 y = feval(f,x,varargin{:}); y = y(:).';
Error in ==> calcSQNRA at 7 x = 10 * log10(3 * 4^t * quadl(f,xmin,xmax));
function [x] = calcSQNRA(xmin, xmax, N)
e = exp(1);
t = log2(N);
f = @(x) x.^2 * e.^(-x);
x = 10 * log10(3 * 4^t * quadl(f,xmin,xmax));
The function is trying to compute the SQNR of an exponential distribution (if I thought of it correctly), after a uniform quantization. Note that if I erase the e.^(-x) from f it actually produces a result. Any ideas?