parameter_Gauss.m
上传用户:hbrsgg3
上传日期:2022-08-01
资源大小:5k
文件大小:5k
- %--------------------------------------------------------------------
- % parameter_Gauss.m -------------------------------------------------
- % Program for the computation of the discrete Doppler frequencies,
- % Doppler coefficients, and Doppler phases by using the Gaussian
- % power spectral density.
- %
- % Used m-files: LPNM_opt_Gauss.m, fun_Gauss.m,
- % grad_Gauss.m, acf_mue.m
- %--------------------------------------------------------------------
- % [f_i_n,c_i_n,theta_i_n]=parameter_Gauss(METHOD,N_i,sigma_0_2,...
- % f_max,f_c,PHASE,PLOT)
- %--------------------------------------------------------------------
- % Explanation of the input parameters:
- %
- % METHOD:
- % |----------------------------------------------|------------------|
- % | Methods for the computation of the discrete | Input |
- % | Doppler frequencies and Doppler coefficients | |
- % |----------------------------------------------|------------------|
- % |----------------------------------------------|------------------|
- % | Method of equal distances (MED) | 'ed_g' |
- % |----------------------------------------------|------------------|
- % | Mean square error method (MSEM) | 'ms_g' |
- % |----------------------------------------------|------------------|
- % | Method of equal areas (MEA) | 'ea_g' |
- % |----------------------------------------------|------------------|
- % | Monte Carlo method (MCM) | 'mc_g' |
- % |----------------------------------------------|------------------|
- % | Lp-norm method (LPNM) | 'lp_g' |
- % |----------------------------------------------|------------------|
- % | Method of exact Doppler spread (MEDS) | 'es_g' |
- % |----------------------------------------------|------------------|
- %
- % N_i: number of harmonic functions
- % sigma_0_2: average power of the real deterministic Gaussian
- % process mu_i(t)
- % f_max: maximum Doppler frequency
- % f_c: 3-dB-cutoff frequency
- %
- % PHASE:
- % |----------------------------------------------|------------------|
- % | Methods for the computation of the Doppler | Input |
- % | phases | |
- % |----------------------------------------------|------------------|
- % |----------------------------------------------|------------------|
- % | Random Doppler phases | 'rand' |
- % |----------------------------------------------|------------------|
- % | Permuted Doppler phases | 'perm' |
- % |----------------------------------------------|------------------|
- %
- % PLOT: plot of the ACF and the PSD of mu_i(t), if PLOT==1
- function [f_i_n,c_i_n,theta_i_n]=parameter_Gauss(METHOD,N_i,...
- sigma_0_2,f_max,f_c,PHASE,PLOT)
- if nargin<7,
- error('Not enough input parameters')
- end
- sigma_0=sqrt(sigma_0_2);
- kappa_c=f_max/f_c;
- % Method of equal distances (MED)
- if METHOD=='ed_g',
- n=(1:N_i)';
- f_i_n=kappa_c*f_c/(2*N_i)*(2*n-1);
- c_i_n=sigma_0*sqrt(2)*sqrt(erf(n*kappa_c*...
- sqrt(log(2))/N_i)-erf((n-1)*kappa_c*...
- sqrt(log(2))/N_i) );
- K=1;
- % Mean square error method (MSEM)
- elseif METHOD=='ms_g',
- n=(1:N_i)';
- f_i_n=kappa_c*f_c/(2*N_i)*(2*n-1);
- tau_max=N_i/(2*kappa_c*f_c);
- N=1E3;
- tau=linspace(0,tau_max,N);
- f1=exp(-(pi*f_c*tau).^2/log(2));
- c_i_n=zeros(size(f_i_n));
- for k=1:length(c_i_n),
- c_i_n(k)=2*sigma_0*sqrt(trapz(tau,f1.*...
- cos(2*pi*f_i_n(k)*tau))/tau_max);
- end
- K=1;
- % Method of equal areas (MEA)
- elseif METHOD=='ea_g'
- n=(1:N_i)';
- c_i_n=sigma_0*sqrt(2/N_i)*ones(size(n));
- f_i_n=f_c/sqrt(log(2))*erfinv(n/N_i);
- f_i_n(N_i)=f_c/sqrt(log(2))*erfinv(0.9999999);
- K=1;
- % Monte Carlo method (MCM)
- elseif METHOD=='mc_g'
- n=rand(N_i,1);
- f_i_n=f_c/sqrt(log(2))*erfinv(n);
- c_i_n=sigma_0*sqrt(2/N_i)*ones(size(n));
- K=1;
- % Lp-norm method (LPNM)
- elseif METHOD=='lp_g',
- if exist('fminu')~=2
- disp([' =====> This method requires ',...
- 'the Optimization Toolbox !!'])
- return
- else
- N=1e3;
- p=2;
- [f_i_n,c_i_n]=LPNM_opt_Gauss(N,f_max,f_c,...
- sigma_0_2,p,N_i,PLOT);
- K=2;
- end
- % Method of exact Doppler spread (MEDS)
- elseif METHOD=='es_g',
- n=(1:N_i)';
- c_i_n=sigma_0*sqrt(2/N_i)*ones(size(n));
- f_i_n=f_c/sqrt(log(2))*erfinv((2*n-1)/(2*N_i));
- K=1;
- else
- error([setstr(10),'Method is unknown'])
- end
- % Computation of the Doppler phases:
- if PHASE=='rand',
- theta_i_n=rand(N_i,1)*2*pi;
- elseif PHASE=='perm',
- n=(1:N_i)';
- Z=rand(size(n));
- [dummy,I]=sort(Z);
- theta_i_n=2*pi*n(I)/(N_i+1);
- end
- if PLOT==1,
- subplot(1,2,1)
- stem([-f_i_n(N_i:-1:1);f_i_n],...
- 1/4*[c_i_n(N_i:-1:1);c_i_n].^2)
- xlabel('f (Hz)')
- ylabel('PSD')
- tau_max=N_i/(K*kappa_c*f_c);
- tau=linspace(0,tau_max,500);
- r_mm=sigma_0_2*exp(-(pi*f_c/sqrt(log(2))*tau).^2);
- r_mm_tilde=acf_mue(f_i_n,c_i_n,tau);
- subplot(1,2,2)
- plot(tau,r_mm,'r-',tau,r_mm_tilde,'g--')
- xlabel('tau (s)')
- ylabel('ACF')
- end