# X = A\B doesn't solve AX = B ?

Discussion in 'MATLAB' started by Matthias Stock, Mar 1, 2004.

1. ### Matthias StockGuest

Hello,
is someone able to find the problem in following lines?
My problem is that the h1 = h, but h2 not :-(
I want to have h2 = h although adding noise (stoep = ytoep + noise).

But the h2 is a singular value, why? How can I change the code to get
h2 = h (about solving equation).

Thanks for any hint!
Matthias.

By copying following lines in your CommandWindow, you will see
that h2 ~=h

*******COPY IN COMMAND WINDOW*******BEGIN******
% here are the values to run the simulation
x1=[1;1;-1;1;-1;1;1;-1;1;-1;1;1;-1;1;1;-1;1;-1;1;1;-1;1;-1;1;1;-1]
h=[0.1337;-0.3781;-0.4602;0.8787;-0.6365]

% building a toeplitz-matrix to solve system of equation

r=x1(q:-1:1) % q values of h, which have to be computed
c=x1(q:1+q-1) % q unknown values, that's why i need at least q
rows,
% p values because of cyclic convolution
xtoep=toeplitz(c,r) % Toeplitz-Matrix
ytoep=xtoep*h % "cyclic-convolution" xtoep and h

stoep=(0.1*randn(p,1))+ytoep % add noise

h1=xtoep\ytoep % computing the q values of h
h2=stoep\ytoep % computing the q values of h with the added
noise,
% _here's the problem_, the noise is
probably reason for
% computing a wrong h2

h % h, to compare it with h1 and h2
*******COPY IN COMMAND WINDOW*******END******

Matthias Stock, Mar 1, 2004