Error in estimating Nakagami parameters using maximum likelihood estimate function: Error using prob.NakagamiDistribution>nakafit (line 271) The data in X must be positive
2 views (last 30 days)
Show older comments
Hello:
I want to compute the m-Nakagami and omega parameters of the generated signal composed from a Nakagami and gaussian supperposed using the MLE function. I get this error every time but I don't know how to fix it. Does anyone here have an idea how to fix it? Thank You in advance.
Error using prob.NakagamiDistribution>nakafit (line 271)
The data in X must be positive
Error in prob.NakagamiDistribution.fit (line 152)
p = nakafit(x,0.05,cens,freq,opt);
Error in fitdist>localfit (line 238)
pd = feval(fitter,x,'cens',c,'freq',f,varargin{:});
Error in fitdist (line 185)
pd = localfit(dist,fitter,x,cens,freq,args{:});
Error in mle (line 400)
pd =
fitdist(data,dist,'cens',cens,'freq',freq,'options',options);
Error in Untitled22 (line 17)
phat_m_Naka= mle(signal,'distribution','Nakagami');
clear;
clc;
pd_cp = makedist('Nakagami','mu',2,'omega',2);
R_cp = random(pd_cp,5000,1);
pd_lp = makedist('Normal','mu',2,'sigma',1);
R_lp = random(pd_lp,5000,1);
R_lp_Linear= 10.^(R_lp./20);
signal=R_cp'+R_lp';
filter_size= 10;
Mean_Power=filter(ones(1,filter_size)/filter_size,1,signal);
short_fading=signal./Mean_Power;
signal=short_fading(filter_size:end);
phat_m_Naka= mle(signal,'distribution','Nakagami');
0 Comments
Answers (1)
Torsten
on 17 Apr 2022
I don't know if this makes sense with respect to what you are trying to do, but MATLAB expects your data to fit a Nakagami distribution to be positive:
signal = short_fading(filter_size:end);
signal = signal(signal > 0);
phat_m_Naka= mle(signal,'distribution','Nakagami');
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!