📄 adsl.m
字号:
%DSL Simulate a standard digital subscriber line.% [Y, H, N] = DSL(X, channelName, P, S) returns the received signal% Y (without channel noise), channel impulse response in H, and% channel noise in N. The channel noise consists of NEXT noise % and AWGN of power P. %% X is the transmitted signal. channelName is a string containing% the channel name. The channel data should be in a subdirectory % "channel". Currently supported channels are the CSA loops from 1 % to 8. The name format is "" where # = {1,2,..,8}. P is the% AWGN power. S is a subsampling factor. The default length of% H is 512 samples. A shorter channel can be generated by subsampling% H by a factor of S. % Copyright (c) 1999-2002 The University of Texas% All Rights Reserved.% % This program is free software; you can redistribute it and/or modify% it under the terms of the GNU General Public License as published by% the Free Software Foundation; either version 2 of the License, or% (at your option) any later version.% % This program is distributed in the hope that it will be useful,% but WITHOUT ANY WARRANTY; without even the implied warranty of% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% GNU General Public License for more details.% % The GNU Public License is available in the file LICENSE, or you% can write to the Free Software Foundation, Inc., 59 Temple Place -% Suite 330, Boston, MA 02111-1307, USA, or you can find it on the% World Wide Web at http://www.fsf.org.% % Programmers: Guner Arslan% Version: @(#)dsl.m 1.4 07/26/00% % The authors are with the Department of Electrical and Computer% Engineering, The University of Texas at Austin, Austin, TX.% They can be reached at arslan@ece.utexas.edu.% Guner Arslan is also with the Embedded Signal Processing% Laboratory in the Dept. of ECE., http://anchovy.ece.utexas.edu.% open a figure for progress bar channelName='csaloop8';% set path for channel files addpath channels% load channel data channelTime = ['load ',channelName,'.time'];eval(channelTime)% put channel data into h and time axis into tstring = ['t = ',channelName,'(:,1); h = ',channelName,'(:,2);'];eval(string)% sampling frequencynoisePower=143;fsample = 2.208e6;% normalization is required due to the way channel data is storedh1 = h/2.208e6;h1 = [h1 ;zeros(2048,1)];% POTS splitter[b a] = cheby1(5,1,4.8e3/fsample,'high'); %a=1; b =1;% channel with splitterh = filter(b,a,h1);%h = decimate(h,5);h = h(1:512);figure(1)stem(h);Ntot=512;f=-1/2+1/Ntot:1/Ntot:1/2;Hn = zeros(1,Ntot);% find Hn vectorfor i=1:length(h) Hn=Hn+h(i)*exp(j*2*pi*f*(i-1)); % This value will be different depending if P represents % P(1) + P(2)*D^-1 + .... or P(1) + P(2)*D^+1...., % but we'll get same gn, thus same waterfilling result. % (Note that both have the same magnitude response!)endfigure(2)plot(10.*log10(abs(Hn)))% find gn vector%gn=abs(Hn).^2/noisePower;%gn=20.*log10(abs(Hn));%plot(gn);%[b a] = butter(1,0.5);%h = filter(b,a,h2);%rampup = linspace(0,1,20);%rampdown = linspace(1,0,20);%h(1:20) = h(1:20).*rampup.';%h(end-19:end) = h(end-19:end).*rampdown.';%h(512:end) = h(512:end).*(length(h(512:end))-1:-1:0)'/(length(h(512:end)));% channel with TEQ if TEQ is given%hw = filter(wteq/(norm(wteq)),1,h2);% filter transmit data with channel impulse response%h = decimate(h,5);%h = [h(1:425); zeros(512-425,1)];
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -