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

📄 wireless_microphone.m

📁 频谱感知 多用户合作 能量检测 伪随机序列
💻 M
字号:
%产生待感知信号:(PART 74 wireless microphone)AM调制的无线话筒信号(载波频率300KHz,调制信号100KHz余弦信号,信噪比为10dB)       
function [S,s]=wireless_microphone(to)
clear all;
echo on
to=1;                                % signal duration
ts=0.001;                              % sampling interval
fs=1/ts;                               % sampling freq
df = 0.8;                              % desired freq resolution
%snr = -6;                               % SNR in dB(log)
t=[0:ts:to];                           % time vertor
%snr_lin=10^(snr/10);                   % SNR
%U=0;
fo=100;                                %modulation freq: 100KHz
fc=300;                                %carrier freg:300KHz 
A1=2;                                 %amplitude of  modulation signal
A2=1;                                 %amplitude of  carrier signal
c=A1*cos(2*pi*fc.*t);                  %carrier signal
m=A2*cos(2*pi*fo.*t);                  %message signal
s=m.*c;                                %AM modulation of wireless mike signal
[M,m,df1]=fftseq(m,ts,df);             %fourier transform
M=M/fs;                                %scaling 
[S,s,df1]=fftseq(s,ts,df);             %fourier transform
S=S/fs;                                %scaling 
f=[0:df1:df1*(length(m)-1)]-fs/2;      %freq vector
%[n,noise_std]=additive_noise_micro(s,snr,U)

%x=s+n;                                 %add noise to the modulated signal
%[X,x,df1]=fftseq(x,ts,df);             %fourier transform
%X=X/fs;                                %scaling

%figure(2)
%subplot(5,1,1)
%plot(t,m(1:length(t)))
%xlabel('Time')
%title('the message signal')
%subplot(5,1,2)
%plot(t,c(1:length(t)))
%xlabel('Time')
%title('the carrier')
%subplot(5,1,3)
%plot(t,s(1:length(t)))
%xlabel('Time')
%title('the modulared signal')
%subplot(5,1,4)
%plot(t,n(1:length(t)))
%xlabel('Time')
%title('noise sample')
%subplot(5,1,5)
%plot(t,x(1:length(t)))
%xlabel('Time')
%title('the recieved signal') 

%figure(1)
%subplot(3,1,1)
%plot(f,abs(fftshift(M)))
%xlabel('Freqence')
%title('Spectrum of the  orignal message signal')
%figure(4)
%subplot(3,1,2)
%plot(f,abs(fftshift(S)));
%xlabel('Freqence')
%title('Spectrum of the modulated signal') 
%figure(3)
%subplot(3,1,3)
%plot(f,abs(fftshift(X)));
%xlabel('频率(kHz)')
%ylabel('幅度(V)')
%title('200kHz带宽AM信号频谱')

⌨️ 快捷键说明

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