BBYR Achieve
返回信息流
这是一条镜像帖。来源:北邮人论坛 / matlab / #8189同步于 2011/5/17
该镜像源已超过 30 天没有更新,可能在源站已被删除。
Matlab机器人发帖

根号升余弦匹配滤波器的仿真求助啊!

stedio
2011/5/17镜像同步1 回复
最近在用matlab仿真基带传输的最佳接收机,使用的脉冲的跟升余弦,信号时4pam。然后接收端进行匹配滤波之后采样量化恢复原信号。目前的代码如下,并附上子函数,现在解码都是误码,不能够正确解调,求教啊~! Here is the main function % recfilt.m: undo pulse shaping using correlation str='This is Steven'; % message to be transmitted m=Fletters2pam4(str); N=length(m); % 4-level signal of length N M=10; mup=zeros(1,N*M); mup(1:M:end)=m; % oversample by M L=10; ps=Fsrrc(L,1,M); % blip pulse of width M x=filter(ps,1,mup); % convolve pulse shape with data y=xcorr(x,ps); % correlate pulse with received signal z=y(N*M:M:end)/(pow(ps)*M); % downsample to symbol rate and normalize mprime=Fquantalph(z,[-3,-1,1,3])'; % quantize to +/-1 and +/-3 alphabet Fpam2letters(mprime) % reconstruct message sum(abs(sign(mprime-m))) % calculate number of errors Fletters2pam4.m % letters2pam4.m: encode a string of ASCII text into +/-1, +/-3 function f = letters2pam4(str); % call as Matlab function N=length(str); % length of string f=zeros(1,4*N); % store 4-PAM coding here for k=0:N-1 % change to "base 4" f(4*k+1:4*k+4)=2*(dec2base(str(k+1),4,4))-99; end pam2letters.m % pam2letters.m: reconstruct string of +/-1 +/-3 into letters function f = newpam2letters(seq) S = length(seq); off = mod(S,4); if off ~= 0 sprintf('dropping last %i PAM symbols',off) seq = seq(1:S-off); end N = length(seq)/4; for k = 0:N-1 f(k+1) = base2dec(char((seq(4*k+1:4*k+4)+99)/2),4); end f = char(f); Fpow.m function y=pow(x) % y=pow(x) calculates the power in the input sequence x y=sum(x.^2)/length(x); Fquantalph.m function y=quantalph(x,alphabet) % function y=quantalph(x,alphabet) % quantize the input signal x to the alphabet % using nearest neighbor method % input x - vector to be quantized % alphabet - vector of discrete values that y can take on % sorted in ascending order % output y - quantized vector [r c] = size(alphabet); if c>r, alphabet=alphabet'; end [r c] = size(x); if c>r, x=x'; end alpha=alphabet(:,ones(size(x)))'; dist=(x(:,ones(size(alphabet)))-alpha).^2; [v,i]=min(dist,[],2); y=alphabet(i); Fsrrc.m function s=Fsrrc(syms, beta, P, t_off); % s=srrc(syms, beta, P, t_off); % Generate a Square-Root Raised Cosine Pulse % 'syms' is 1/2 the length of srrc pulse in symbol durations % 'beta' is the rolloff factor: beta=0 gives the sinc function % 'P' is the oversampling factor % 't_off' is the phase (or timing) offset if nargin==3, t_off=0; end; % if unspecified, offset is 0 k=-syms*P+1e-8+t_off:syms*P+1e-8+t_off; % sampling indices as a multiple of T/P if (beta==0), beta=1e-8; end; % numerical problems if beta=0 s=4*beta/sqrt(P)*(cos((1+beta)*pi*k/P)+... % calculation of srrc pulse sin((1-beta)*pi*k/P)./(4*beta*k/P))./... (pi*(1-16*(beta*k/P).^2));
订阅后,新回复会通过你的通知中心匿名送达。
1 条回复
zzn10机器人#1 · 2011/11/18
你要考虑1-16*(beta*k/P).^2==0的情况 【 在 stedio 的大作中提到: 】 : 最近在用matlab仿真基带传输的最佳接收机,使用的脉冲的跟升余弦,信号时4pam。然后接收端进行匹配滤波之后采样量化恢复原信号。目前的代码如下,并附上子函数,现在解码都是误码,不能够正确解调,求教啊~! : Here is the main function : % recfilt.m: undo pulse shaping using correlation : ...................