MATLAB程序qpsk_dsp.m产生ccs调用的函数数据文件,运行出错! 50
fsample=9000;fsymbol=1500;sy=fsample/fsymbol;Number=20;walsh0=(1:sy)*0+1;Data_I=sign(...
fsample = 9000;
fsymbol = 1500;
sy = fsample/fsymbol;
Number = 20;
walsh0 = (1:sy)*0+1;
Data_I = sign(randn(Number*sy,1));
Data_I1 = kron(Data_I,walsh0);
Data_I2 = reshape(Data_I',[],1);
rcoscoeff = rcosine(fsymbol,fsample,'sqrt',0.35,5);
Data_I3 = conv(rcoscoeff,Data_I2);
Data_I3 = Data_I3(31:end-30);
fsin = sin(2*pi*(1:Number*sy)*1800/1900);
fqpsk = Data_I3.*fsin';
noise = randn(length(fqpsk),1);
fqpsknoise = fqpsk+noise;
fqpsknorcos = Data_I2.*fsin';
figure(1)
subplot(3,1,1);
plot(Data_I2)
axis([0 Number*sy 1.1*min(Data_I2) 1.1*max(Data_I2)])
ylabel('amplitude');xlabel('(a)point');
subplot(3,1,2);
plot(Data_I3)
ylabel('amplitude');xlabel('(b)point');
subplot(3,1,3);
plot(rcoscoeff);
ylabel('amplitude');xlabel('(c)point');
figure(2)
freqz(rcoscoeff);
figure(3)
subplot(3,1,1);
plot(fqpsk);
ylabel('amplitude');xlabel('(a)point');
subplot(3,1,2);plot(fqpsknoise);
ylabel('amplitude');xlabel('(b)point');
subplot(3,1,3);
plot(fqpsknorcos);
ylabel('amplitude');xlabel('(c)point');
figure(4)
n = (1:Number*sy)/(Number*sy)*2;
subplot(3,1,1);
plot(n,20*log(abs(fft(fqpsk))))
ylabel('magnitude(dB)');xlabel('\omega^pi');
subplot(3,1,2);
plot(n,20*log(abs(fft(fqpsknoise))))
ylabel('magnitude(dB)');xlabel('\omega^pi');
subplot(3,1,3);
plot(n,20*log(abs(fft(fqpsknorcos))))
ylabel('magnitude(dB)');xlabel('\omega^pi');
MATLAB2CCS('Data_I2.dat',Data_I2/2,'frac');
MATLAB2CCS('noise.dat',noise/2,'frac');
h=[rcoscoeff 0 0 0];
b=round(h*(2^15-1));
fid=fopen('rcoscoeff.txt','w');
for i=1:8
fprintf(fid,'\r\t%s\t','.word');
for j=(i-1)*8+1:(i-1)*8+7
%fprintf(fid,'%05xH',b(j));
fprintf(fid,'%6.0f',b(j));
end
%fprintf(fid,'%05xH',b((i-1)*8+8));
fprintf(fid,'%6.0f',b((i-1)*8+8));
end
fclose(fid); 展开
fsymbol = 1500;
sy = fsample/fsymbol;
Number = 20;
walsh0 = (1:sy)*0+1;
Data_I = sign(randn(Number*sy,1));
Data_I1 = kron(Data_I,walsh0);
Data_I2 = reshape(Data_I',[],1);
rcoscoeff = rcosine(fsymbol,fsample,'sqrt',0.35,5);
Data_I3 = conv(rcoscoeff,Data_I2);
Data_I3 = Data_I3(31:end-30);
fsin = sin(2*pi*(1:Number*sy)*1800/1900);
fqpsk = Data_I3.*fsin';
noise = randn(length(fqpsk),1);
fqpsknoise = fqpsk+noise;
fqpsknorcos = Data_I2.*fsin';
figure(1)
subplot(3,1,1);
plot(Data_I2)
axis([0 Number*sy 1.1*min(Data_I2) 1.1*max(Data_I2)])
ylabel('amplitude');xlabel('(a)point');
subplot(3,1,2);
plot(Data_I3)
ylabel('amplitude');xlabel('(b)point');
subplot(3,1,3);
plot(rcoscoeff);
ylabel('amplitude');xlabel('(c)point');
figure(2)
freqz(rcoscoeff);
figure(3)
subplot(3,1,1);
plot(fqpsk);
ylabel('amplitude');xlabel('(a)point');
subplot(3,1,2);plot(fqpsknoise);
ylabel('amplitude');xlabel('(b)point');
subplot(3,1,3);
plot(fqpsknorcos);
ylabel('amplitude');xlabel('(c)point');
figure(4)
n = (1:Number*sy)/(Number*sy)*2;
subplot(3,1,1);
plot(n,20*log(abs(fft(fqpsk))))
ylabel('magnitude(dB)');xlabel('\omega^pi');
subplot(3,1,2);
plot(n,20*log(abs(fft(fqpsknoise))))
ylabel('magnitude(dB)');xlabel('\omega^pi');
subplot(3,1,3);
plot(n,20*log(abs(fft(fqpsknorcos))))
ylabel('magnitude(dB)');xlabel('\omega^pi');
MATLAB2CCS('Data_I2.dat',Data_I2/2,'frac');
MATLAB2CCS('noise.dat',noise/2,'frac');
h=[rcoscoeff 0 0 0];
b=round(h*(2^15-1));
fid=fopen('rcoscoeff.txt','w');
for i=1:8
fprintf(fid,'\r\t%s\t','.word');
for j=(i-1)*8+1:(i-1)*8+7
%fprintf(fid,'%05xH',b(j));
fprintf(fid,'%6.0f',b(j));
end
%fprintf(fid,'%05xH',b((i-1)*8+8));
fprintf(fid,'%6.0f',b((i-1)*8+8));
end
fclose(fid); 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励30(财富值+成长值)+提问者悬赏50(财富值+成长值)
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询