MATLAB Answers

Calculate Nakagami m parameter using the mle function

15 views (last 30 days)
youcha
youcha on 2 Jan 2021
Commented: youcha on 12 Jan 2021
Hello,
I have generated a Nakagami distribution and a Gaussian distribution and added them together. The resulted signal called "Signal_total". Later, I applied a FIR filter on "Signal_total" and substructed the filtered signal from the "signal_total". The result of the substruction is called "fast_fading". The next step is to compute the m Nakagami parameter of the "fast_fading" using the mle function of matlab. The problem is matlab returns the following error:
Error using prob.NakagamiDistribution>nakafit (line 271)
The data in X must be positive
I want to know that this error comes from having negative values in the vector "fast_fading" But I do not know How to make them positive without changing their statistics? something like unit convertion o other thing
Here is my code:
pd_cp = makedist('Nakagami','mu',2,'omega',2);
R_cp = random(pd_cp1,5000,1);
pd_lp = makedist('Normal','mu',0,'sigma',1);
R_lp = random(pd_lp,5000,1);
Signal_total=R_cp+R_lp;
filtersize=5;
Mean_Pwr=filter(ones(1,filtersize)/filtersize,1,Signal_total);
fast_fading=Signal_total-Mean_Pwr;
fast_fading=fast_fading(filtersize:end);
phat(T,:)= mle(fast_fading,'distribution','Nakagami');
Thank you in advance.

  0 Comments

Sign in to comment.

Answers (1)

Jeff Miller
Jeff Miller on 2 Jan 2021
I think the minimum change you need is
fast_fading=fast_fading(filtersize:end);
fast_fading = fast_fading - min(fast_fading); % Maybe also add eps if mle will not accept x=0
phat(T,:)= mle(fast_fading,'distribution','Nakagami');
This will change the mean of fast_fading but none of its other statistics.

  3 Comments

youcha
youcha on 3 Jan 2021
So, you mean by substructing the min from the "fast_fading" I will get ositive values without changing the statistical distribution parameters of the vector "fast_fading" ?
Jeff Miller
Jeff Miller on 3 Jan 2021
Only the mean will change, not the standard deviation, skewness, kurtosis, etc. You can easily verify this by calling the appropriate functions before and after subtracting the min.
Perhaps even better, make histograms of the fast_fading values before and after the subtraction. The two histograms will look identical except for the labelling of the horizontal axis. After subtraction, the zero point on the x axis will be just at the minimum of the histogram.
youcha
youcha on 12 Jan 2021
A profesor told me to work with the envelope of the signal, this way I will have only positive values. However, I have a doubt: which one of these is correct to calculate the envelope is it the "[upper, lower]=envelope(signal)" function and take just the upper part later or just calculate the 10^(signal) ?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by