matlab信道仿真经典源程序

上传人:飞*** 文档编号:30720510 上传时间:2018-01-31 格式:DOCX 页数:3 大小:13.93KB
返回 下载 相关 举报
matlab信道仿真经典源程序_第1页
第1页 / 共3页
matlab信道仿真经典源程序_第2页
第2页 / 共3页
matlab信道仿真经典源程序_第3页
第3页 / 共3页
亲,该文档总共3页,全部预览完了,如果喜欢就下载吧!
资源描述

《matlab信道仿真经典源程序》由会员分享,可在线阅读,更多相关《matlab信道仿真经典源程序(3页珍藏版)》请在金锄头文库上搜索。

1、% % Rayleigh Fading Channel Signal Generator % Using the Dent Model (a modification to the Jakes Model)% Last Modified 10/18/05% Author: Avetis Ioannisyan ()% Usage:% omega_mTau, Tk = % ai_RayCh(NumAngles, Length, SymbolRate, NumWaveforms, CarrierFreq, Velocity)% Where the output omega_mTau is a tim

2、e scaling factor for plotting% normalized correlations. The LAGS value output by C,LAGS = XCORR(.)% should be multiplied by the omega_mTau scaling factor to properly display% axis. Tk is a two dimensional vector M, N = SIZE(Tk) with% M=numWaverorms and N=Length specified in the RayCh(.) function cal

3、l% And the input variables are:% NumAngles - scalar power of 2, NumAngles 27 is used to specify the% number of equally strong rays arriving at the receiver. It used to% compute the number of oscillators in the Dent model with N0 = numAngles/4% Length - scalar preferably power of 2 for faster computa

4、tion, Length 217% is used to specify the length of the generated sequence. Lengths near 1E6% are close to realistic signals% % SymbolRate - scalar power of 2 and is in kilo-symbols-per-sec is used to% specify what should be the transmission data rate. Slower rates will% provide slowly fading channel

5、s. Normal voice and soem data rates are% 64-256 ksps% NumWaveforms - scalar used to specify how many k waveforms to generate% in the model. NumWaveforms 2 to properly display plots% % CarrierFreq - scalar expressed in MHz is the carrier frequency of the% tranmitter. Normally 800 or 1900 MHz for mobi

6、le comms% Velocity - scalar expressed in km/hr is the speed of the receiver. % 100 km/hr = 65 mi/hr. Normal values are 20-130 km/hr% % Usage Examples:% omega_mTau, Tk = ai_RayCh(27, 218, 64, 2, 900, 100)% % where% NumAngles=27, Length=218, symbolRate=64, NumWaveforms=2, carrierFreq=900, Velocity=100

7、% omega_mTau, Tk = RayCh(NumAngles, Length, symbolRate, NumWaveforms,% carrierFreq, Velocity);%function omega_mTau, Tk = ai_RayCh(NumAngles, Length, symbolRate, NumWaveforms, carrierFreq, Velocity)% Number of oscillatorsN0 = NumAngles/4;% Maximum Doppler shift of carrier at some wavelengthomega_m =

8、(2*pi) * fm(Velocity, carrierFreq);% specify variance of the Rayleigh channel% use this for *constant* variange - requires changing other params in progsigma2 = 10;% make sigma2 a gaussian RV around u = sigma2 and var = sigma2/5% use for *non constant* variaance - requires changing other params in p

9、rogsigma2 = sigma2 + sqrt(sigma2/5) .* randn(1,NumWaveforms);% Initialize phasesalpha_n = ; beta_n = ; theta_nk = ; % make a hadamard matrixAk = hadamard(N0);% determine phase values alpha and betan=1:N0;alpha_n = 2*pi*n/NumAngles - pi/NumAngles;beta_n = pi*n/N0;% convert to time scale using fs samp

10、ling frequencyt=1/(symbolRate*1000):1/(symbolRate*1000):1/(symbolRate*1000) * Length;Tk = ;for q = 1 : NumWaveformsrand(state,sum(100*clock) % reset randomizertheta_nk = rand(1,length(n) * 2 *pi; % create uniform random phase in range 0,2pi sumRes = 0;for i = 1 : N0term1 = Ak(NumWaveforms,i);term2 =

11、 cos(beta_n(i) + j*sin(beta_n(i);term3 = cos(omega_m .* t .* cos(alpha_n(i) + theta_nk(i);sumRes = sumRes + (term1 .* term2 .* term3);endTk(q,:) = sqrt(2/N0) .* sumRes;% use line below to apply *non-constant* variance Tk(q,:) = repmat(10.(sigma2(q)/20),1, Length) .* Tk(q,:); %apply variable in dB en

12、d% apply *constant* variance unilaterly in dB % Tk = repmat(10(sigma2/20), k, Length) .* Tk; % plot resultsfigure(20); subplot(3,1,1); semilogy(t,abs(Tk(1,:);xlabel(Time (sec); ylabel(Signal Strength (dB); title(Received Envelope, Symbol Rate = , num2str(symbolRate), ,Carrier = , num2str(carrierFreq

13、), , Velocity = , num2str(Velocity);% compute auto and cross correlations and plot themomega_mTau = (1/(symbolRate*1000) * (omega_m/(2*pi); % compute omega_m * tau scalingC1, Lags = crosscorr(Tk(1,:), Tk(2,:), 20000);C2, Lags2 = autocorr(Tk(1,:), 20000);figure(20); subplot(3,1,3); plot(Lags * omega_

14、mTau, C1);xlabel(Normalized Time Delay); ylabel(Normalized Crosscorrelation); title(Crosscorrelation between waveforms k=1 and k=2);figure(20); subplot(3,1,2); plot(Lags2 * omega_mTau, C2);xlabel(Normalized Time Delay); ylabel(Normalized Autocorrelation); title(Autocorrelation of the first waveform k=1);

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 其它办公文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号