1/22/13 11:58 AM

C:\Users\Solo...\uwb_sv_eval_ct_15_4a.m

1 of 4

% modified S-V channel model evaluation % % Written by Sun Xu, Kim Chee Wee, B. Kannan & Francois Chin on 14/09/2004 clear; no_output_files = 1; responses num_channels = 100; randn('state',12); rand('state',12); % non-zero: avoids writing output files of continuous-time % number of channel impulse responses to generate % initialize state of function for repeatability % initialize state of function for repeatability

cm_num = 1; % channel model number from 1 to 8 % get channel model params based on this channel model number [Lam,lambda,Lmean,lambda_mode,lambda_1,lambda_2,beta,Gam,gamma_0,Kgamma, ... sigma_cluster,nlos,gamma_rise,gamma_1,chi,m0,Km,sigma_m0,sigma_Km, ... sfading_mode,m0_sp,std_shdw,kappa,fc,fs] = uwb_sv_params_15_4a( cm_num ); fprintf(1,['Model Parameters\n' ... ' Lam = %.4f, lambda = %.4f, Lmean = %.4f, lambda_mode(FLAG) = %d\n' ... ' lambda_1 = %.4f, lambda_2 = %.4f, beta = %.4f\n' ... ' Gam = %.4f, gamma0 = %.4f, Kgamma = %.4f, sigma_cluster = %.4f\n' ... ' nlos(FLAG) = %d, gamma_rise = %.4f, gamma_1 = %.4f, chi = %.4f\n' ... ' m0 = %.4f, Km = %.4f, sigma_m0 = %.4f, sigma_Km = %.4f\n' ... ' sfading_mode(FLAG) = %d, m0_sp = %.4f, std_shdw = %.4f\n', ... ' kappa = %.4f, fc = %.4fGHz, fs = %.4fGHz\n'], ... Lam,lambda,Lmean,lambda_mode,lambda_1,lambda_2,beta,Gam,gamma_0,Kgamma, ... sigma_cluster,nlos,gamma_rise,gamma_1,chi,m0,Km,sigma_m0,sigma_Km,... sfading_mode,m0_sp,std_shdw,kappa,fc,fs);

ts = 1/fs; % sampling frequency % get a bunch of realizations (impulse responses) [h_ct,t_ct,t0,np] = uwb_sv_model_ct_15_4a(Lam,lambda,Lmean,lambda_mode,lambda_1, ... lambda_2,beta,Gam,gamma_0,Kgamma,sigma_cluster,nlos,gamma_rise,gamma_1, ... chi,m0,Km,sigma_m0,sigma_Km,sfading_mode,m0_sp,std_shdw,num_channels,ts); % now reduce continuous-time result to a discrete-time result [hN,N] = uwb_sv_cnvrt_ct_15_4a( h_ct, t_ct, np, num_channels, ts ); if N > 1, h = resample(hN, 1, N); % decimate the columns of hN by factor N else h = hN; end % correct for 1/N scaling imposed by decimation % h = h * N; % normalized below.. % prepare to add the frequency dependency K = 1; % K = Ko*Co^2/(4*pi)^2/d^n % since the K is a constant, and the effect will be removed after % normalization, so the K is set to be 1 h_len = length(h(:,1)); if (cm_num == 1|cm_num == 2| cm_num == 7|cm_num == 8|cm_num ==9) [h]= uwb_sv_freq_depend_ct_15_4a(h,fc,fs,num_channels,kappa);

'Model Characteristics\n'). num_sig_paths(k) = sum(temp_h > temp_thresh).^2) * sq_h ).. fprintf(1. plot([1:num_channels].. plot(t.k)).1f.. mean_sig_paths. num_sig_paths = zeros(1.m 2 of 4 else [h]= uwb_sv_freq_depend_ct_15_4a(h. paths (captures x % of energy in channel) x = 0. figure(1). % determine number of significant paths (paths within 10 dB from peak) threshold_dB = -10. end energy_mean = mean(10*log10(channel_energy)).. mean_sig_paths = mean(num_sig_paths).' Channel energy: mean = %.' Mean delays: excess (tau_m) = %.. grid on title('Impulse response realizations') xlabel('Time (nS)') figure(2). .1f dB.. % dB temp_h = abs(h(:. for k=1:num_channels % determine excess delay and RMS delay sq_h = abs(h(:. RMS (tau_rms) = %1. t = [0:(h_len-1)] * ts. mean_sig_e_paths = mean(num_sig_e_paths). energy_stddev = std(10*log10(channel_energy)).^2). RMS_delay(k) = sqrt( ((t_norm-excess_delay(k)). . % for use in computing excess & RMS delays excess_delay = zeros(1.fs. % sorted in ascending order of energy cum_energy = cumsum(temp_sort(end:-1:1)). temp_sort = sort(temp_h. temp_thresh = 10^(threshold_dB/20) * max(temp_h). abs(h)). % determine number of sig.. % cumulative energy index_e = min(find(cum_energy >= x * cum_energy(end))). .^2). fprintf(1. std deviation = %. % remove the randomized arrival time of first cluster excess_delay(k) = t_norm * sq_h.k)).^2 / channel_energy(k).f\n'. num_sig_e_paths = zeros(1.\uwb_sv_eval_ct_15_4a. RMS_delay = zeros(1. t_norm = t .num_channels.85.num_channels)..t0(k).1f dB\n'.num_channels). clf.. fprintf(1. fprintf(1. excess_delay.1f ns. num_sig_e_paths(k) = index_e. mean_excess_delay = mean(excess_delay). mean_sig_e_paths). mean_excess_delay. end %******************************************************************** % Testing and ploting %******************************************************************** % channel energy channel_energy = sum(abs(h). mean_RMS_delay = mean(RMS_delay).num_channels). energy_mean. clf.' # paths: NP_10dB = %.num_channels). energy_stddev). mean_RMS_delay). NP_85%% = %..1f\n'.0).fc. 'b-'. . .1/22/13 11:58 AM C:\Users\Solo.

grid on title('Excess delay (nS)') xlabel('Channel number') figure(3). 'Mean'.*(abs(h))')/num_channels. average_decay_profile_dB = 10*log10(temp_average_power)..fs. . num_sig_e_paths. legend(figh.\uwb_sv_eval_ct_15_4a. . mean_excess_delay*[1 1].'b-'...4. '\pm Std. 'r--'). plot([1:num_channels]. clf. . plot([1:num_channels]. 0) end if no_output_files. 'b-'. mean_sig_e_paths*[1 1]. clf figh = plot([1:num_channels]... 'Per-channel energy'.-0. grid on title('Number of significant paths within 10 dB of peak') xlabel('Channel number') figure(5)..10*log10(channel_energy).. RMS_delay. 'r--' ). [1 num_channels]. deviation'. [1 num_channels].. energy_mean-energy_stddev*[1 1]. return end %********************************************************************* %removing the freq dependency of the antenna for cm_num=3.1/22/13 11:58 AM C:\Users\Solo.. num_sig_paths. [1 num_channels].. 'r--').m 3 of 4 [1 num_channels].average_decay_profile_dB). [1 num_channels]. mean_RMS_delay*[1 1].5&6 %********************************************************************* if (cm_num == 3|cm_num == 4| cm_num == 5|cm_num == 6) [h]= uwb_sv_freq_depend_ct_15_4a(h. 'b-'. 'r:'. grid on axis([0 t(end) -60 0]) title('Average Power Decay Profile') xlabel('Delay (nsec)') ylabel('Average power (dB)') if 0 figure(7). .num_channels. grid on title('Number of significant paths capturing > 85% energy') xlabel('Channel number') temp_average_power = sum((abs(h))'. grid on title('RMS delay (nS)') xlabel('Channel number') figure(4). plot([1:num_channels].. 'r:'). . [1 num_channels]. plot(t. end . energy_mean+energy_stddev*[1 1]. xlabel('Channel number') ylabel('dB') title('Channel Energy').fc. [1 num_channels]. clf. clf. mean_sig_paths*[1 1].. 'b-'. clf. energy_mean*[1 1]. figure(6). .82). 'r--' ).. temp_average_power = temp_average_power/max(temp_average_power). 'g--'..

1) fprintf(fid.\uwb_sv_eval_ct_15_4a.6f\r\n'. 'np'.. th_ct(k.csv file for impulse response.%. return.. % \r\n for Windoze end-of-line end fclose(fid). file may be open in another application').2:2:end) = h_ct. error('unable to write .'.2)). % number of paths % File #2: cmX_imr. % Two comma-delimited text files for non-Matlab users: % File #1: cmX_imr_np. % odd columns are time th_ct(:. np.csv can open with Excel % n'th pair of columns contains the (time.4f.').2*size(t_ct. % even columns are values fid = fopen([save_fn '. 'h_ct'.m 4 of 4 %************************************************************************** %Savinge the data %************************************************************************** %%% save continuous-time (time.6f. 't_ct'.1).mat']. end for k = 1:size(th_ct.csv'].1:end-2)). th_ct(k. % end of program .value) pairs for the n'th realization th_ct = zeros(size(t_ct. th_ct(:. 't0'. fprintf(fid. cm_num).end-1:end)).'%. 'num_channels'.%. 'w'). if fid < 0.4f.csv']. 'cm_num').value) pairs to files save_fn = sprintf('cm%d_imr'.'%.1/22/13 11:58 AM C:\Users\Solo. '.1:2:end) = t_ct. % A complete self-contained file for Matlab users save([save_fn '.csv lists the number of paths in each realization dlmwrite([save_fn '_np.

Sign up to vote on this title
UsefulNot useful