⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 example.m

📁 这是我师兄做的空间谱估计的内容。这只是一小部分程序
💻 M
字号:
clear;clc;
%set up parameters.
M=2;     %number of symbolsin alphabet.
len=100; %number of symbols in the original message.
Fd=1;    %assume the original message is sampled at a 
         %rate of 1 sample per second.
Fs=100;  %the modulated signal will be sampled at a 
         %rate of 100 samples per second.
Fc=10;   %the frequence of the modulated signal.
signal=randint(len,1,M);%random digital message consisting of 
                         %integers between 0 and M-1
%figure(1);stem(signal);
mp=modmap(signal,Fd,Fs,'ask',M);%map a digital signal to an analog signal
%figure(2);plot((1:len*Fs/Fd)/(Fs/Fd),mp);
%plot the analog signal
modsignal=dmod(mp,Fc,Fd,Fs,'ask/nomap',M);
%use M-ary ASK modulation
%figure(3);plot((1:len*Fs/Fd)/(Fs/Fd),modsignal);
%plot the modulated signal
%adding noise
noisy=modsignal+5*randn(len*Fs/Fd,1);
%demodulating the signal
newsignal=ddemod(noisy,Fc,Fd,Fs,'ask',M);
%figure(4);stem(newsignal);
%figure(5);stem(signal-newsignal)
%computing and displaying bit error rates
[num,rate]=biterr(newsignal,signal);
disp('-----------------------------------------')
disp('bit error rates:')
disp(num2str(rate))

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -