博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
基于MATLAB的模拟调制信号与解调的仿真——DSB
阅读量:2135 次
发布时间:2019-04-30

本文共 1666 字,大约阅读时间需要 5 分钟。

     实现模拟调制信号与解调的仿真是我的MATLAB课程设计的一部分,我参考了网上的一些资料,并加入了一些自己的想法,代码已在本地MATLAB编译通过且能正常运行

       DSB——双边带调制

dt=0.001; %时间采样间隔fm=1; %信源最高频率fc=10; %载波中心频率T=5; %信号时长t=0:dt:T;mt=sqrt(2)*cos(2*pi*fm*t); %信源figure(1)subplot(311);plot(t,mt);title('调制信号')coss=cos(2*pi*fc*t);subplot(312);plot(t,coss);title('载波信号')%N0=0.01; %白噪声单边功率谱密度%DSB调制s_dsb=mt.*cos(2*pi*fc*t);B=2*fm;%noise=noise_nb(fc,B,N0,t);%s_dsb=s_dsb+noise;subplot(313)plot(t,s_dsb); %画出DSB信号波形hold onplot (t,mt,'r--'); %标出m(t)波形hold onplot(t,-mt,'r--');title('DSB调制信号'); %DSB相干解调rt=s_dsb.*cos(2*pi*fc*t);figure(2);subplot(311);plot(t,rt);title('DSB调制信号与载波信号相乘')[f,rf]=T2F(t,rt);%傅里叶变换[t,rt]=lpf(f,rf,fm);%低通滤波subplot(312)plot(t,rt);title('经过低通滤波的相干解调信号波形');rt=rt-mean(rt);subplot(313)[f,sf]=T2F(t,s_dsb);%傅里叶变换psf=(abs(sf).^2)/T;plot(f,psf);axis([-2*fc 2*fc 0 max(psf)]);title('DSB信号功率谱');

用到的函数

①T2F.m

function [f,sf]= T2F(t,st)%利用FFT计算信号的频谱并与信号的真实频谱的抽样比较。%脚本文件T2F.m定义了函数T2F,计算信号的傅立叶变换。%This is a function using the FFT function to calculate a signal Fourier%Translation%Input is the time and the signal vectors,the length of time must greater%than 2%Output is the frequency and the signal spectrumdt = t(2)-t(1);T=t(end);df = 1/T;N = length(st);f=-N/2*df : df : N/2*df-df;sf = fft(st);sf = T/N*fftshift(sf);

②lpf.m

function [t,st]=lpf(f,sf,B)%This function filter an input data using a lowpass filter%Inputs: f: frequency samples% sf: input data spectrum samples% B: lowpass bandwidth with a rectangle lowpass%Outputs: t: time samples% st: output data time samplesdf = f(2)-f(1);T = 1/df;hf = zeros(1,length(f));%全零矩阵bf = [-floor( B/df ): floor( B/df )] + floor( length(f)/2 );hf(bf)=1;yf=hf.*sf;[t,st]=F2T(f,yf);st = real(st);

 

转载地址:http://mwfgf.baihongyu.com/

你可能感兴趣的文章
【LEETCODE】14-Longest Common Prefix
查看>>
【LEETCODE】38-Count and Say
查看>>
【LEETCODE】278-First Bad Version
查看>>
【LEETCODE】303-Range Sum Query - Immutable
查看>>
【LEETCODE】21-Merge Two Sorted Lists
查看>>
【LEETCODE】231-Power of Two
查看>>
【LEETCODE】172-Factorial Trailing Zeroes
查看>>
【LEETCODE】112-Path Sum
查看>>
【LEETCODE】9-Palindrome Number
查看>>
【极客学院】-python学习笔记-Python快速入门(面向对象-引入外部文件-Web2Py创建网站)
查看>>
【LEETCODE】190-Reverse Bits
查看>>
【LEETCODE】67-Add Binary
查看>>
【LEETCODE】7-Reverse Integer
查看>>
【LEETCODE】165-Compare Version Numbers
查看>>
【LEETCODE】299-Bulls and Cows
查看>>
【LEETCODE】223-Rectangle Area
查看>>
【LEETCODE】12-Integer to Roman
查看>>
【学习方法】如何分析源代码
查看>>
【LEETCODE】61- Rotate List [Python]
查看>>
【LEETCODE】143- Reorder List [Python]
查看>>