|
Greg Heath <heath@alumni.brown.edu> wrote in message <3578f777-80b3-48ec-a74e-990e1d62a8b9@v25g2000yqk.googlegroups.com>...
> On Dec 12, 8:35?pm, "Vijayalayan " <xcitingind...@yahoo.com> wrote:
> > "Wayne King" <wmkin...@gmail.com> wrote in message <hcs3rr$bp...@fred.mathworks.com>...
> > > "Vijayalayan T.R." <xcitingind...@yahoo.com> wrote in message <hcs392$4v...@fred.mathworks.com>...
> > > > Hello all,
> >
> > > > This is my first post so if its in an inappropriate section, my apologies.
> > > > ?So this is the situation, I'm working on my postgrad project which involves locating a cell phone and I use Time Difference of Arrival with wavelet denoising filtering. I came across someone else's work which is similar to mine but in a diff technology. So I took up to study his code to get an idea of what I'm supposed to do.
> >
> > > > In this test program.
> > > > this line is not working
> >
> > > > randn('state', 2*(i+j));
> > > > ? ? ? ? noi1_real=sqrt(pow/(2*oran))*randn(1,1024);
> >
> > > > And the error is
> > > > ??? Error using ==> randn
> > > > State must be a double scalar or the output of RANDN('state').
> >
> > > > Error in ==> tez5 at 36
> > > > ? ? ? ? randn('state', t);
> >
> > > > Can anyone throw some light on what I'm supposed to do.
> >
> > > > Thanks in advance
> >
> > > > Cheers
> > > > Vi
> >
> > > Hi, what are i and j equal to? If you don't assign these in your code, then by default they will be the complex number 0 + 1.0000i and you will get the above error.
> > > Wayne
> >
> > Hello Wayne,
> > Sorry for the delayed reply. ?As I told you, I'm trying to understand the code and I'm totally new to Matlab. I'm not sure about the i and j part. Sorry to sound dumb. I just don't have any Matlab experience. The code on reading makes some sense as in what the author is trying to do but thats about it.
> >
> > ?I have put the code here for your viewing.
> >
> > clear all
> > gsm_set;
> > data=data_gen(INIT_L);
> >
> > %this creates a binary data
> > [tx_burst,I,Q]=gsm_mod(Tb,OSR,BT,data,TRAINING);
> >
> > s=I+j*Q;
>
> j is never defined.Therefore, by default, MATLAB assumes
> j = sqrt(-1)
>
> ____SNIP
>
> > ?for k=1:length(SNR)
> > ? ?oran=SNR(k)
> > ? ? for i=1:K
> > ? ? ? ? x=[zeros(1,200) s zeros(1,224)];
> > ? ? ? ? y=[zeros(1,200+delay(i)) s zeros(1,224-delay(i))];
> >
> > ? ? ? ? t = 2*(i+j);
> > ? ? ? ? randn('state', t);
>
> 1. t cannot be complex.
> 2. If this was a typo and it was meant to be t = 2*(i+k) then it
> would work. However, it would not be correct. Only
> random numbers generated from a single state will have
> the desired statistical distribution. The most logical place
> for the state initialization is before the loop, not within it.
>
> Hope this helps.
>
> Greg
Hey Greg,
The t bit was tried by me as an debugging attempt. As you can see below, the coder has tried 2*(i+j) and then 3*(i+j) , 4*(i+j) and 5*(i+j). So I doubt it being a typo for 4times. As far as I can understand, the code is used to create real and imaginary parts of noi1 and no2 (noises 1 & 2). Then noi1 is added to x to create xn(assume x with noise) and noi2 is added to y to create yn. but I don't the way it has been implemented and hence the error.
t = 2*(i+j);
randn('state', t);
noi1_real=sqrt(pow/(2*oran))*randn(1,1024);
randn('state',3*(i+j));
noi1_imag=sqrt(pow/(2*oran))*randn(1,1024);
randn('state',4*(i+j));
noi2_real=sqrt(pow/(2*oran))*randn(1,1024);
randn('state',5*(i+j));
noi2_imag=sqrt(pow/(2*oran))*randn(1,1024);
|