what do you mean by umat?

6 views (last 30 days)
monalisa  ghosh
monalisa ghosh on 5 Feb 2015
Edited: Guillaume on 5 Feb 2015
Uncertain matrix with 0 rows, 0 columns, and no uncertain blocks.
Type "ans.NominalValue" to see the nominal value, "get(ans)" to see all properties, and "ans.Uncertainty" to interact with the uncertain elements.
  2 Comments
Guillaume
Guillaume on 5 Feb 2015
If you want an answer, you're going to have to give a lot more context.
monalisa  ghosh
monalisa ghosh on 5 Feb 2015
Edited: Guillaume on 5 Feb 2015
the code is:
%BLOCKLMS
% Call:
% [e,w]=blocklms(mu,M,u,Dalton);
%
% Input arguments:
% mu = step size, dim 1x1
% M = filter length, dim 1x1
% u = input signal, dim Nx1
% d = desired signal, dim Nx1
%
% Output arguments:
% e = estimation error, dim Nx1
% w = final filter coefficients, dim Mx1
%
% The length N is adjusted such that N/M is integer!
%
%initialization
M=128;
N=200;
w=zeros(M,1);
L=floor(N/M)*M;
d=zeros(M,1);
u=zeros(M,1);
d=d(1:L);
e=d;
u=u(1:L);
N=length(u);
%no. of blocks
Blocks=N/M;
%Loop, BlockLMS
for k=1:Blocks-1
%Set up input signal matrix, dim. MxM (cf. example 1, Haykin p. 448)
umat=toeplitz(u(k*M:1:(k+1)*M-1),u(k*M:-1:(k-1)*M+1));
%Set up vector with desired signal
dvec=d(k*M:1:(k+1)*M-1);
%calculate output signal (Eq.10.5)
yvec=umat*w;
%calculate error vector (Eq.10.8)
evec=dvec-yvec;
%log error
e(k*M:1:(k+1)*M-1)=evec;
%calculate gradient estimate (Eq.10.11)
phi=umat.*evec;
%update filter coefficients (Eq.10.10)
w=w+mu*phi;
end
display(umat);
After running the code , the result iam getting is:
ans =
Uncertain matrix with 0 rows, 0 columns, and no uncertain blocks.
Type "ans.NominalValue" to see the nominal value, "get(ans)" to see all properties, and "ans.Uncertainty" to interact with the uncertain elements.
so what to do now?

Sign in to comment.

Accepted Answer

Guillaume
Guillaume on 5 Feb 2015
Edited: Guillaume on 5 Feb 2015
the root of your problem is that your for loop body never gets executed because Blocks = 1 (so you're asking the loop to go from 1 to 0). As a result, the variable umat never gets created and when your code reaches the line
display(umat)
it actually calls the function umat of one of matlab's toolbox. This is this function that raises the error you see (I assume, I don't have that toolbox).
One obvious way to prevent this problem is to have the following code just before the loop:
if Blocks < 2
error("Blocks is less that 2. Aborting script. Review your inputs");
end
That obviously won't resolve the underlying problem that one of your input or calculation prior to that is not what it should. As your code is written, N would need to be at least twice the value of M for Blocks to be at least 2.
Also, are you aware that you're changing the value of your input N within the code. N starts as 200 and is modified to 128. I don't know if it's intended or not. I would avoid reusing the same variable name for different purpose. It can only lead to bugs in the long term.
Finally, I would avoid using length. numel for vectors or size for matrices is better. length can be the number of rows or columns or pages, etc. depending on which dimension is greater. It's very rare you don't care about which dimension you want the size of.

More Answers (0)

Categories

Find more on Sparse Matrices in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!