Calculate Nakagami m parameter using the mle function
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Jeff Miller
2021-1-2
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 个评论
Jeff Miller
2021-1-3
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.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!