Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Estimate initial sampling instant in Matlab
Replies: 1   Last Post: Nov 15, 2012 10:12 AM

 Messages: [ Previous | Next ]
 Barry Williams Posts: 312 Registered: 6/14/06
Re: Estimate initial sampling instant in Matlab
Posted: Nov 15, 2012 10:12 AM

"Ankur " <ankbhat@yahoo.com> wrote in message <k82fmn\$j3d\$1@newscl01ah.mathworks.com>...
> Hi, I am writing a matlab code to estimate the initial sampling instant in 16 QAM.
>
> I am using the early late method to do this i.e downsample the received signal at different sampling instances and calculating the energy of the signals at each instant and averaging it over certain number of symbols. The instant with maximum energy is the optimum sampling instant.
>
> Here is how I do it.
> function Est_Samp_inst = Ninit_Estimate_Energy(s2);
> N=16;
> for Ninit = 1:1:16 % To determine sampling point (1<=Ninit<=N)
> X_hat = s2(Ninit:N:end);
> Energy(Ninit)=sum(abs(X_hat).^2); %% Energy calculation %%%
> Avg_Power(Ninit)=Energy(Ninit)/(length(X_hat)); %%%Average Power Calculation%%%
> end
>
> %%% Loop to identify maximum average power location%%%%
> for i=1:1:length(Avg_Power)
> if Avg_Power(i)==max(Avg_Power)
> Est_Samp_inst=i;
> end
> end
>
> Somehow, I don't get correct values?
> Please request any feedback on this.
>
> Thanks

A few comments. I'm not sure what you mean by *don't get correct values*.
Note also that 1:length(Avg_Power) is the same as 1:1:length(Avg_Power).
Do you possibly have negative values in X_hat? When those are squared, they become positive.
I tried the segment of code that you provided with: Avg_Power = 0:.1:pi
It correctly returned the index value of Est_Samp_inst = 17.
But remember that i is defined in ML as sqrt(-1). If you need elsewhere in your code the correct value of that imaginary term, you may get a conflict. That section of code is really awkward, however. I'm not sure why you're not using the much simpler and quicker: Est_Samp_inst = max(Avg_Power)

Barry

Date Subject Author
11/15/12 Ankur
11/15/12 Barry Williams