% dsb1.m
% Matlab demonstration script for DSB-AM modulation. The message signal
% is +1 for 0 < t < t0/3, -2 for t0/3 < t < 2t0/3 and zero otherwise.
echo on
t0=.15; % signal duration
ts=0.001; % sampling interval
fc=250; % carrier frequency
snr=20; % SNR in dB (logarithmic)
fs=1/ts; % sampling frequency
df=0.3; % desired freq. resolution
t=[0:ts:t0]; % time vector
snr_lin=10^(snr/10); % linear SNR
% message signal
m=[ones(1,t0/(3*ts)),-2*ones(1,t0/(3*ts)),zeros(1,t0/(3*ts)+1)];
c=cos(2*pi*fc.*t); % carrier signal
u=m.*c; % modulated signal
[M,m,df1]=fftseq(m,ts,df); % Fourier transform
M=M/fs; % scaling
[U,u,df1]=fftseq(u,ts,df); % Fourier transform
U=U/fs; % scaling
[C,c,df1]=fftseq(c,ts,df); % Fourier transform
f=[0:df1:df1*(length(m)-1)]-fs/2; % freq. vector
signal_power=spower(u(1:length(t))); % power in modulated signal
noise_power=signal_power/snr_lin; % compute noise power
noise_std=sqrt(noise_power); % compute noise standard deviation
noise=noise_std*randn(1,length(u)); % generate noise
r=u+noise; % add noise to the modulated signal
[R,r,df1]=fftseq(r,ts,df); % spectrum of the signal+noise
R=R/fs; % scaling
pause % Press a key to show the modulated signal power
signal_power
pause % Press any key to see a plot of the message
clf
subplot(2,2,1)
plot(t,m(1:length(t)))
xlabel('Time')
title('The message signal')
pause % Press any key to see a plot of the carrier
subplot(2,2,2)
plot(t,c(1:length(t)))
xlabel('Time')
title('The carrier')
pause % Press any key to see a plot of the modulated signal
subplot(2,2,3)
plot(t,u(1:length(t)))
xlabel('Time')
title('The modulated signal')
pause % Press any key to see a plots of the magnitude of the message and the
% modulated signal in the frequency domain.
subplot(2,1,1)
plot(f,abs(fftshift(M)))
xlabel('Frequency')
title('Spectrum of the message signal')
subplot(2,1,2)
plot(f,abs(fftshift(U)))
title('Spectrum of the modulated signal')
xlabel('Frequency')
pause % Press a key to see a noise sample
subplot(2,1,1)
plot(t,noise(1:length(t)))
title('noise sample')
xlabel('Time')
pause % Press a key to see the modulated signal and noise
subplot(2,1,2)
plot(t,r(1:length(t)))
title('Signal and noise')
xlabel('Time')
pause % Press a key to see the modulated signal and noise in freq. domain
subplot(2,1,1)
plot(f,abs(fftshift(U)))
title('Signal spectrum')
xlabel('Frequency')
subplot(2,1,2)
plot(f,abs(fftshift(R)))
title('Signal and noise spectrum')
xlabel('Frequency')
![avatar](https://profile-avatar.csdnimg.cn/6a7aa99d23544fe38965063dcf203f49_weixin_42664597.jpg!1)
小贝德罗
- 粉丝: 89
- 资源: 1万+
最新资源
- springboot097大学生竞赛管理系统_zip.zip
- springboot096基于springboot的租房管理系统_zip.zip
- springboot092安康旅游网站的设计与实现_zip.zip
- springboot099大型商场应急预案管理系统_zip.zip
- springboot100精准扶贫管理系统_zip.zip
- 基于51单片机的温度报警器C程序设计及Proteus仿真报告:按键设置温度上下限,超限蜂鸣器报警功能实现,基于51单片机的温度报警器C程序设计及Proteus仿真报告:按键设置温度上下限,智能报警提醒
- springboot102基于web的音乐网站_zip.zip
- java项目之宠物诊所系统设计源码.zip
- springboot104学生网上请假系统设计与实现_zip.zip
- springboot113健身房管理系统_zip.zip
- springboot105基于保信息学科平台系统设计与实现_zip.zip
- springboot117基于SpringBoot的企业资产管理系统_zip.zip
- springboot118共享汽车管理系统_zip.zip
- springboot116基于java的教学辅助平台_zip.zip
- 高频方波电压注入模型:静止坐标下电流分量提取与无感速度矢量控制,高频方波电压注入模型:静坐标下电流分量提取与无感速度矢量控制技术,该模型在d轴注入高频的方波电压,在静止坐标下通过前后周期的电电流相应提
- log库,谷歌软件开发日志库
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)