xlabel('t');%x¨??????
ylabel('vp');%y¨??????
title('????¨????????§????§??????????§');%
% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) dt=0.00001; %????¨????¨??????
t=-0.005:dt:0.005;%????¨??????????§????§??????ì fm=600;%??
mt=cos(2*pi*fm*t);%????????¨??????
fc=4000; %??????§
ct=cos(2*pi*fc*t); %??????§????¨??????
mf=4;%??
vf=cos(2*pi*fc*t+mf*sin(2*pi*fm*t));%FM??????????§????¨??????
mp=4;%????¨????????§????§
vp=cos(2*pi*fc*t+mp*cos(2*pi*fm*t));%PM??????????§????¨??????
Fs=2500; %¨??????
T=1/Fs; %¨????????????????ì????ì L=1200; %??????ì????ì t=(0:L-1)*T; %????¨???? y=cos(2*pi*fm*t);
NFFT=L; %y??????ì????ìL
Y=fft(y,NFFT)/L;
f=Fs/2*linspace(0,1,NFFT/2); %0-Fs/2¨????????§????§??????§????§NFFT/2 Fm=2*abs(Y(1:NFFT/2));
plot(f,Fm) %¨??????¨?????????????? xlabel('Frequency/Hz');%x¨?????? ylabel('magnitude');%y¨?????? title('????');%
% --- Executes on button press in pushbutton6.
function pushbutton6_Callback(hObject, eventdata, handles) % hObject handle to pushbutton6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) dt=0.00001; %????¨????¨??????
t=-0.005:dt:0.005;%????¨??????????§????§??????ì fm=600;%??
mt=cos(2*pi*fm*t);%????????¨??????
fc=4000; %??????§
ct=cos(2*pi*fc*t); %??????§????¨??????
mf=4;%??
vf=cos(2*pi*fc*t+mf*sin(2*pi*fm*t));%FM??????????§????¨??????
mp=4;%????¨????????§????§
vp=cos(2*pi*fc*t+mp*cos(2*pi*fm*t));%PM??????????§????¨?????? Fs=2000; %¨??????
T=1/Fs; %¨????????????????ì????ì L=900; %??????ì????ì t=(0:L-1)*T; %????¨???? y=cos(2*pi*fc*t+mf*sin(2*pi*fm*t)); NFFT=L; %y??????ì????ìL Y=fft(y,NFFT)/L;
f=Fs/2*linspace(0,1,NFFT/2); %0-Fs/2¨????????§????§??????§????§NFFT/2 Fm=2*abs(Y(1:NFFT/2));
plot(f,Fm) %¨??????¨??????FM??????????§???? xlabel('Frequency/Hz');%x¨?????? ylabel('magnitude');%y¨?????? title('??????');%
% --- Executes on button press in pushbutton7.
function pushbutton7_Callback(hObject, eventdata, handles) % hObject handle to pushbutton7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) dt=0.00001; %????¨????¨??????
t=-0.005:dt:0.005;%????¨??????????§????§??????ì fm=600;%??
mt=cos(2*pi*fm*t);%????????¨??????
fc=4000; %??????§
ct=cos(2*pi*fc*t); %??????§????¨??????
mf=4;%??
vf=cos(2*pi*fc*t+mf*sin(2*pi*fm*t));%FM??????????§????¨?????? mp=4;%????¨????????§????§
vp=cos(2*pi*fc*t+mp*cos(2*pi*fm*t));%PM??????????§????¨??????
Fs=2000; %¨??????
T=1/Fs; %¨????????????????ì????ì L=900; %??????ì????ì t=(0:L-1)*T; %????¨????
y=cos(2*pi*fc*t+mf*sin(2*pi*fm*t)); NFFT=L; %y??????ì????ìL Y=fft(y,NFFT)/L;
f=Fs/2*linspace(0,1,NFFT/2); %0-Fs/2¨????????§????§??????§????§NFFT/2 Fm=2*abs(Y(1:NFFT/2)); Fs=2000; %¨??????
T=1/Fs; %¨????????????????ì????ì L=900; %??????ì????ì t=(0:L-1)*T; %????¨????
y=cos(2*pi*fc*t+mp*cos(2*pi*fm*t)); NFFT=L; %y??????ì????ìL Y=fft(y,NFFT)/L;
f=Fs/2*linspace(0,1,NFFT/2); %0-Fs/2¨????????§????§??????§????§NFFT/2 Pm=2*abs(Y(1:NFFT/2)); plot(f,Pm)
xlabel('Frequency/Hz');%x¨?????? ylabel('magnitude');%y¨??????
title('????????¨????????§????§????');%
% --- Executes on button press in pushbutton8.
function pushbutton8_Callback(hObject, eventdata, handles) % hObject handle to pushbutton8 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) dt=0.00001; %????¨????¨??????
t=-0.005:dt:0.005;%????¨??????????§????§??????ì fm=600;%??
mt=cos(2*pi*fm*t);%????????¨??????
fc=4000; %??????§
ct=cos(2*pi*fc*t); %??????§????¨??????
mf=4;%??
vf=cos(2*pi*fc*t+mf*sin(2*pi*fm*t));%FM??????????§????¨?????? mp=4;%????¨????????§????§
vp=cos(2*pi*fc*t+mp*cos(2*pi*fm*t));%PM??????????§????¨?????? Fs=2000; %¨??????
T=1/Fs; %¨????????????????ì????ì L=900; %??????ì????ì
t=(0:L-1)*T; %????¨????
y=cos(2*pi*fc*t+mf*sin(2*pi*fm*t)); NFFT=L; %y??????ì????ìL Y=fft(y,NFFT)/L;
f=Fs/2*linspace(0,1,NFFT/2); %0-Fs/2¨????????§????§??????§????§NFFT/2 Fm=2*abs(Y(1:NFFT/2));
Fs=2000; %¨??????
T=1/Fs; %¨????????????????ì????ì L=900; %??????ì????ì t=(0:L-1)*T; %????¨???? y=cos(2*pi*fc*t+mp*cos(2*pi*fm*t)); NFFT=L; %y??????ì????ìL
Y=fft(y,NFFT)/L;
f=Fs/2*linspace(0,1,NFFT/2); %0-Fs/2¨????????§????§??????§????§NFFT/2 Pm=2*abs(Y(1:NFFT/2));
dt=0.001;
%¨????¨??????????§??????????ì????ì
t=0:dt:1.5; %¨??????¨??????????¨????
am=15; %¨????¨??????????§??????????§????§¨??????¨??????fm=5; %¨????¨??????????§????¨?????? mt=am*cos(2*pi*fm*t); %¨??????????
fc=50;
%¨????¨??????????§??????§¨??????
ct=cos(2*pi*fc*t); %¨????????????§ kf=10; %¨????¨??????????§???? vt=cos(2*pi*fc*t+10*15*sin(2*pi*fm*t)/(2*pi*fm)); %????¨??????¨?????? vt1=vt;
for i=1:length(t)-1 %??????§??????§????§????¨?????? diff_vt1(i)=(vt1(i+1)-vt1(i))/dt;
end
diff_vt2 abs(hilbert(diff_vt1)); %hilbert????¨????????????????§????§¨????????????§????¨??????¨????????????§
zero=(max(diff_vt2)-min(diff_vt2))/2;
diff_vt3=diff_vt2-zero;
plot((1:length(diff_vt3))/1000,diff_vt3/400); title('????????¨????');
% --- Executes on button press in pushbutton9.
function pushbutton9_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton9 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
dt=1/1000; %????¨????¨??????
= t=0:dt:1.5 %????¨??????????§????§??????ì fm=5; %¨????¨??????????§???? mt=square(2*pi*fm*t,50); %¨?????????? fc=50; %??????§
ct=cos(2*pi*fc*t); %??????§????¨?????? kf=100; %¨????¨??????????§???? int_mt(1)=0;
for i=1:length(t)-1
int_mt(i+1)=int_mt(i)+mt(i)*dt; %¨??????m(t)??????§????§ end %????¨??????¨?????????? vt=cos(2*pi*fc*t+kf*int_mt); %??
plot(mt);
axis([0,1500,-3,3]); title('????????¨????');
% --- Executes on button press in pushbutton10.
function pushbutton10_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton10 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
dt=1/1000; %????¨????¨??????
t=0:dt:1.5 %????¨??????????§????§??????ì fm=5; %¨????¨??????????§???? mt=square(2*pi*fm*t,50); %¨?????????? fc=50; %??????§
ct=cos(2*pi*fc*t); %??????§????¨?????? kf=100; %¨????¨??????????§???? int_mt(1)=0;
for i=1:length(t)-1
int_mt(i+1)=int_mt(i)+mt(i)*dt; %¨??????m(t)??????§????§ end %????¨??????¨?????????? vt=cos(2*pi*fc*t+kf*int_mt); %??
plot(ct);
axis([0,1500,-1,1]); title('??????§????¨????');
% --- Executes on button press in pushbutton11.
function pushbutton11_Callback(hObject, eventdata, handles)
信号与线性系统课程设计
报告
课题五 FM调制与解调系统的设计
班级:电子C102
姓名:王伟泽
学号:108021
成绩:
指导教师:刘翠响
日期:2013年1月04日
题目:FM调制与解调系统的设计
摘要
FM在通信系统中的使用非常广泛。FM广泛应用于高保真音乐广播、电视伴音信号的传输、卫星通信和蜂窝电话系统等。
本设计主要是利用MATLAB集成环境下的M文件,编写程序来实现FM调制与解调过程,并分别绘制出基带信号,载波信号,已调信号的时域波形;再进一步分别绘制出对已调信号叠加噪声后信号,相干解调后信号和解调基带信号的时域波形;最后绘出FM基带信号通过上述信道和调制和解调系统后的误码率与信噪比的关系,并通过与理论结果波形对比来分析该仿真调制与解调系统的正确性及噪声对信号解调的影响。在课程设计中,系统开发平台为Windows Vista,使用工具软件为MATLAB 7.0。在该平台运行程序完成了对FM调制和解调以及对叠加噪声后解调结果的观察。通过该课程设计,达到了实现FM信号通过噪声信道,调制和解调系统的仿真目的。
关键词 FM;PM;调制;解调;MATLAB 7.0;SIMULINK;LABVIEW;
1课程设计的目的、意义 1.1本课题的目的
本课程设计课题主要研究FM 调制与解调模拟系统的理论设计和软件仿真方法。通过完成本课题的设计,拟主要达到以下几个目的:
1.掌握模拟系统FM 调制与解调的原理。 2.掌握模拟系统FM 调制与解调的设计方法;
3.掌握应用MATLAB分析系统时域、频域特性的方法,进一步锻炼应用Matlab进行编程仿真的能力;
4.熟悉基于Simulink的动态建模和仿真的步骤和过程;
5.了解基于LabVIEW虚拟仪器的特点和使用方法,熟悉采用LabVIEW进行仿真的方法。
1.2本课题的意义
本课程设计课题主要研究FM 调制与解调模拟系统的理论设计和软件仿真方法。通过完成本课题的设计,意在使学生将高频电子线路、数字信号处理、信号与线性系统等所学知识融汇起来,加深对“FM调制与解调”的理解和认识,真正达到学以致用的目的。
2 设计任务及技术指标
设计FM调制与解调模拟系统,仿真实现相关功能。 包括: 可实现单音调制的FM调制及解调、PM调制及解调的系统设计及仿真,要求给出系统的设计框图、源程序代码及仿真结果,并要求给出程序的具体解释说明,记录系统的各个输出点的波形和频谱图。具体内容为:
(1)设计FM调制与解调、PM调制与解调的模拟系统,给出系统的原理框图,对系统的主要参数进行设计说明。
(2)采用Matlab语言设计相关程序,实现系统的功能,要求采用两种方式进行仿真,即直接采用Matlab语言编程的静态仿真方式、采用Simulink进行动态建模和仿真的方式。要求采用两种以上调制信号源进行仿真,并记录系统的各个输出点的波形和频谱图。
(3)采用LabVIEW进行仿真设计,实现系统的功能,要求给出系统的前面板和框图,采用两种以上调制信号源进行仿真,并记录仿真结果。
(4)要求对系统的时域、频域特性进行分析,并与理论设计结果进行比较分析。
(5)对系统功能进行综合测试,整理数据,撰写设计报告。 调频信号的参数主要有: (1)最大角频偏??m
它是瞬时角频率??(t)的最大值;最大频偏?fm是瞬时频偏?f(t)的最大值。
??m或?fm反映了频率受调制的程度,是衡量调频质量的重要指标。??m或?fm和
kf与
V?m成正比,与调制信号频率F无关。FM波瞬时频率变化范围为
fc??fm~fc??fm,最大变化量为2?fm。
kf(2)调制系数(调制灵敏度)
kf???mU?m(rad/s?V)
(1-8)
V?m 它表示数。
对瞬时(角)频率的控制能力,是产生FM信号电路的重要参
(3)调频指数
M???m??Mf
?fmFf???m (1-9)
Mf它是单音调制信号引起的最大瞬时相角偏移量。 但以大于1,而且常常远远大于1。
FM信号的频谱有如下特点:
与F成反比。
Mf可
以载频fc为中心,由无穷多对以调制信号频率F为间隔的边频分量组成,各分量幅值取决于Bessel函数,且以fc对称分布;
载波分量并不总是最大,有时为零; FM信号的功率大部分集中在载频附近; 频谱结构与F密切相关;
调频波解调又称鉴频,其中一种方法为将输入调频信号进行特定的波形变换,使变换后的波形包含有反映瞬时频率变化的平均分量。然后通过低通滤波器就能输出所需的解调电压。
3 MATLAB源程序
1) 单音FM调制与解调(余弦波)
figure(1)
dt=0.00001; %时间域的取样间隔 t=-0.005:dt:0.005;%时间域范围 fm=600;%调制信号的频率
mt=cos(2*pi*fm*t);%调制信号的表达式
subplot(2,2,1),plot(t,mt);grid %产生并画出FM调制信号 xlabel('t');%x轴名称 ylabel('Vt');%y轴名称
title('调制信号');%图形名称
fc=4000; %载波信号的频率
ct=cos(2*pi*fc*t); %载波信号的表达式
subplot(2,2,2),plot(t,ct);grid %产生并画出载波信号 xlabel('t');%x轴名称 ylabel('ct');%y轴名称
title('载波信号');%图形名称
%调制过程 对载波信号积分 实现调制信号 mf=4;%调频指数
vf=cos(2*pi*fc*t+mf*sin(2*pi*fm*t));%FM已调波信号表达式 subplot(2,2,3),plot(t,vf);grid %产生并画出FM已调波信号 xlabel('t');%x轴名称
ylabel('vf');%y轴名称
title('调频已调波信号');%图形名称 mp=4;%调相指数
vp=cos(2*pi*fc*t+mp*cos(2*pi*fm*t));%PM已调波信号表达式 subplot(2,2,4),plot(t,vp);grid %产生并画出PM已调波信号 xlabel('t');%x轴名称 ylabel('vp');%y轴名称
title('调相已调波信号');%图形名称
figure(2)
Fs=2500; %采样频率; T=1/Fs; %采样时间步长; L=1200; %数据长度 t=(0:L-1)*T; %时间序列 y=cos(2*pi*fm*t);
NFFT=L; %y数据长度即为L Y=fft(y,NFFT)/L;
f=Fs/2*linspace(0,1,NFFT/2); %在0-Fs/2之间,等间距分布NFFT/2数据点 Fm=2*abs(Y(1:NFFT/2));
plot(f,Fm) %产生并画出调制信号频谱 xlabel('Frequency/Hz');%x轴名称 ylabel('magnitude');%y轴名称 title('调制信号频谱');%图形名称
figure(3)
Fs=2000; %采样频率;
T=1/Fs; %采样时间步长; L=900; %数据长度 t=(0:L-1)*T; %时间序列 y=cos(2*pi*fc*t+mf*sin(2*pi*fm*t)); NFFT=L; %y数据长度即为L
Y=fft(y,NFFT)/L;
f=Fs/2*linspace(0,1,NFFT/2); %在0-Fs/2之间,等间距分布NFFT/2数据点 Fm=2*abs(Y(1:NFFT/2));
plot(f,Fm) %产生并画出FM已调波信号频谱 xlabel('Frequency/Hz');%x轴名称 ylabel('magnitude');%y轴名称
title('已调调频信号频谱');%图形名称
figure(4)
图3-6-3
图3-6-4
图3-6-5
4 GUI用户界面设计
1) 单音
function varargout = zuizhongjieguo(varargin) % ZUIZHONGJIEGUO M-file for zuizhongjieguo.fig
% ZUIZHONGJIEGUO, by itself, creates a new ZUIZHONGJIEGUO or raises the existing
% singleton*. %
% H = ZUIZHONGJIEGUO returns the handle to a new ZUIZHONGJIEGUO or the handle to
% the existing singleton*. %
% ZUIZHONGJIEGUO('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in ZUIZHONGJIEGUO.M with the given input arguments. %
% ZUIZHONGJIEGUO('Property','Value',...) creates a new ZUIZHONGJIEGUO or raises the
% existing singleton*. Starting from the left, property value pairs are % applied to the GUI before zuizhongjieguo_OpeningFunction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to zuizhongjieguo_OpeningFcn via varargin. %
% *See GUI Options on GUIDE's Tools menu. Choose \% instance to run (singleton)\%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Copyright 2002-2003 The MathWorks, Inc.
% Edit the above text to modify the response to help zuizhongjieguo
% Last Modified by GUIDE v2.5 04-Jan-2013 08:38:29
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @zuizhongjieguo_OpeningFcn, ... 'gui_OutputFcn', @zuizhongjieguo_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1}); end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else
gui_mainfcn(gui_State, varargin{:}); end
% End initialization code - DO NOT EDIT
% --- Executes just before zuizhongjieguo is made visible.
function zuizhongjieguo_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % varargin command line arguments to zuizhongjieguo (see VARARGIN)
% Choose default command line output for zuizhongjieguo handles.output = hObject;
% Update handles structure guidata(hObject, handles);
% UIWAIT makes zuizhongjieguo wait for user response (see UIRESUME) % uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = zuizhongjieguo_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure varargout{1} = handles.output;
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles) % hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
dt=0.00001; %????¨????¨??????
t=-0.005:dt:0.005;%????¨??????????§????§??????ì fm=600;%??
mt=cos(2*pi*fm*t);%????????¨?????? plot(t,mt);grid %¨??????¨??????FM???? xlabel('t');%x¨?????? ylabel('Vt');%y¨?????? title('??');%
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles) % hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) dt=0.00001; %????¨????¨??????
t=-0.005:dt:0.005;%????¨??????????§????§??????ì fm=600;%??
mt=cos(2*pi*fm*t);%????????¨??????
fc=4000; %??????§
ct=cos(2*pi*fc*t); %??????§????¨?????? plot(t,ct);grid %¨??????¨????????????§ xlabel('t');%x¨?????? ylabel('ct');%y¨?????? title('??????§');% %??????????§??????§????§????
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles) % hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
dt=0.00001; %????¨????¨??????
t=-0.005:dt:0.005;%????¨??????????§????§??????ì fm=600;%??
mt=cos(2*pi*fm*t);%????????¨??????
fc=4000; %??????§
ct=cos(2*pi*fc*t); %??????§????¨??????
mf=4;%??
vf=cos(2*pi*fc*t+mf*sin(2*pi*fm*t));%FM??????????§????¨?????? plot(t,vf);grid %¨??????¨??????FM??????????§ xlabel('t');%x¨?????? ylabel('vf');%y¨??????
title('??????????????§');%
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles) % hObject handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
dt=0.00001; %????¨????¨??????
t=-0.005:dt:0.005;%????¨??????????§????§??????ì fm=600;%??
mt=cos(2*pi*fm*t);%????????¨??????
fc=4000; %??????§
ct=cos(2*pi*fc*t); %??????§????¨??????
mf=4;%??
vf=cos(2*pi*fc*t+mf*sin(2*pi*fm*t));%FM??????????§????¨??????
mp=4;%????¨????????§????§
vp=cos(2*pi*fc*t+mp*cos(2*pi*fm*t));%PM??????????§????¨?????? plot(t,vp);grid %¨??????¨??????PM??????????§
图3-2-3
3) 单音FM调制与解调(方波)
figure(1);
dt=1/1000; %时间域的取样间隔 t=0:dt:1.5 %时间域范围 fm=5; %设定调制信号频率 mt=square(2*pi*fm*t,50); %生成调制信号 fc=50; %载波信号的频率
ct=cos(2*pi*fc*t); %载波信号的表达式 kf=100; %设定调频指数 int_mt(1)=0;
for i=1:length(t)-1
int_mt(i+1)=int_mt(i)+mt(i)*dt; %求信号m(t)的积分
end %调制,产生已调信号 vt=cos(2*pi*fc*t+kf*int_mt); %调制信号 subplot(4,1,1); plot(mt);
axis([0,1500,-3,3]); title('调制信号的时域图'); subplot(4,1,2); plot(ct);
axis([0,1500,-1,1]); title('载波信号的时域图'); subplot(4,1,3);
plot(vt);
axis([0,1500,-1.2,1.2]); title('已调信号的时域图');
vt1=vt;
for i=1:length(t)-1 %接受信号通过微分器处理 diff_vt1(i)=(vt1(i+1)-vt1(i))/dt; end
diff_vt2 = abs(hilbert(diff_vt1)); %hilbert变换,求绝对值得到瞬时幅度(包络检波)
zero=(max(diff_vt2)-min(diff_vt2))/2; diff_vt3=diff_vt2-zero;
subplot(4,1,4); %绘制解调信号的时域图 plot((1:length(diff_vt3))/1000,diff_vt3/400); title('解调信号的时域图');
figure(2);
subplot(2,1,1)
Fs=20; %频域采样频率; T=1/Fs; %时域采样间隔; N=1024; %数据长度 t=(0:N-1)*T; %时间序列
fm=5; %设定调制信号频率←可更改 mt=square(2*pi*fm*t,50); %生成调制信号 NFFT=N; %数据长度即为N
Y=fft(mt,NFFT)/N;
f=Fs/2*linspace(0,1,NFFT/2); %在0-Fs/2之间,等间距分布NFFT/2数据点 Am=2*abs(Y(1:NFFT/2)); plot(f,Am)
title('调制信号频谱')
xlabel('Frequency/Hz'),ylabel('magnitude') subplot(2,1,2)
Fs=20; %采样频率;
T=1/Fs; %采样时间步长; N=1024; %数据长度 t=(0:N-1)*T;
fm=5; %设定调制信号频率
mt=square(2*pi*fm*t,50); %生成调制信号 NFFT=N; %数据长度即为N
Y=fft(vt,NFFT)/N;
f=Fs/2*linspace(0,1,NFFT/2); %在0-Fs/2之间,等间距分布NFFT/2数据点 Am=2*abs(Y(1:NFFT/2)); plot(f,Am)
title('已调信号频谱')
xlabel('Frequency/Hz'),ylabel('magnitude') 图3-3-1
图3-3-2
4) 单音PM调制与解调(方波)
figure(1);
dt=0.001; %设定时间步长 t=0:dt:1.5; %产生时间向量
fm=5; %设定调制信号频率←可更改 mt=square(2*pi*fm*t,50); %生成调制信号
fc=10;
%设定载波频率←可更改
ct=cos(2*pi*fc*t); %生成载波 kp=2; %设定调相指数 vt=cos(2*pi*fc*t+kp*mt);
subplot(3,1,1);
plot(mt);
axis([0,1500,-1.5,1.5]); title('调制信号的时域图'); subplot(3,1,2);
plot(ct);
axis([0,1500,-1,1]);
title('载波信号的时域图'); subplot(3,1,3); plot(vt);
axis([0,1500,-1.2,1.2]); title('已调信号的时域图');
figure(2);
am=15; %设定调制信号幅度←可更改 fm=5; %设定调制信号频率←可更改 mt=square(2*pi*fm*t,50); %生成调制信号
fc=10; %设定载波频率←可更改 ct=cos(2*pi*fc*t); %生成载波 kf=10; %设定调频指数 vt=cos(2*pi*fc*t+kp*mt);
%调制,产生已调信号
%调制,产生已调信号
subplot(2,1,1)
Fs=20; %采样频率; T=1/Fs; %采样间隔; N=1024; %数据长度 t=(0:N-1)*T; %时间序列
mt=square(2*pi*fm*t,50); %生成调制信号
NFFT=N; %数据长度即为N Y=fft(mt,NFFT)/N;
f=Fs/2*linspace(0,1,NFFT/2); %在0-Fs/2之间,等间距分布NFFT/2数据点
Am=2*abs(Y(1:NFFT/2));
plot(f,Am)
title('调制信号频谱')
xlabel('Frequency/Hz'),ylabel('magnitude')
subplot(2,1,2)
Fs=200; %采样频率; T=1/Fs; %采样时间步长; N=1024; %数据长度 t=(0:N-1)*T; %时间序列 vt=cos(2*pi*fc*t+kp*mt);
%调制,产生已调信号
NFFT=N; %数据长度即为N
Y=fft(vt,NFFT)/N;
f=Fs/2*linspace(0,1,NFFT/2); %在0-Fs/2之间,等间距分布NFFT/2数据点 Am=2*abs(Y(1:NFFT/2)); plot(f,Am)
title('已调信号频谱')
xlabel('Frequency/Hz'),ylabel('magnitude')
figure(3)
dt=0.001;
%设定时间步长
t=0:dt:1.5; %产生时间向量
am=15; %设定调制信号幅度←可更改 fm=5; %设定调制信号频率←可更改 mt=square(2*pi*fm*t,50); %生成调制信号 fc=10; ct=cos(2*pi*fc*t);
%设定载波频率←可更改 %生成载波
kf=10; %设定调频指数 vt=cos(2*pi*fc*t+kp*mt); %调制,产生已调信号
vt1=vt;
for i=1:length(t)-1 %接受信号通过微分器处理 diff_vt1(i)=(vt1(i+1)-vt1(i))/dt; end
diff_vt2 = abs(hilbert(diff_vt1)); %hilbert变换,求绝对值得到瞬时幅度(包络检波)
zero=(max(diff_vt2)-min(diff_vt2))/2; diff_vt3=diff_vt2-zero;
plot(mt);
axis([0,1500,-1.5,1.5]); title('解调信号的时域图'); 图3-4-1
图3-4-2
图3-4-3
5) FM双音调制源程序
syms AA;
dt=0.000001; %产生并画出调制信号 t=0.000001:dt:0.015;
am1=5;fm1=100; %设定调制信号基本参数 am2=2;fm2=150;
fc=1000; %产生画出载波信号 Vc=cos(2*pi*fc*AA);
Mf=40; %设定调频指数 Kf=Mf*fm2/am2; fmax=fm2*Mf;
Vt=am1*cos(2*pi*fm1*AA)+am2*cos(2*pi*fm2*AA); %调制信号 intf=int(Vt,AA)
Va=cos(2*pi*fc*AA+Kf*intf) %对载波信号积分
figure(1)
subplot(3,1,1),plot(t, subs(Vt,AA,t)); xlabel('t'); ylabel('Vt');
title('多音FM调制信号');
subplot(3,1,2),plot(t, subs(Vc,AA,t)); xlabel('t');
ylabel('Vc');
title('多音FM载波信号');
subplot(3,1,3),plot(t, subs(Va,AA,t)); xlabel('t');
ylabel('Va');
title('多音FM调频已调波信号');
figure(2)
Fs=600; %采样频率; T=1/Fs; %采样时间步长; L=2000; %数据长度
t=(0:L-1)*T; %时间序列
y= am1*cos(2*pi*fm1*t)+am2*sin(2*pi*fm2*t); NFFT=L; %y数据长度即为L Y=fft(y,NFFT)/L;
f=Fs/2*linspace(0,1,NFFT/2); %在0-Fs/2之间,等间距分布NFFT/2数据点 Am=2*abs(Y(1:NFFT/2)); plot(f,Am)
title('多音FM调制信号频谱')
xlabel('Frequency/Hz'),ylabel('magnitude')
figure(3)
Fs=4000; %采样频率;
T=1/Fs; %采样时间步长; L=2000; %数据长度 t=(0:L-1)*T; %时间序列 y=cos(2*pi*fc*AA+Kf*intf); y=subs(y,AA,t);
NFFT=L; %y数据长度即为L Y=fft(y,NFFT)/L;
f=Fs/2*linspace(0,1,NFFT/2); %在0-Fs/2之间,等间距分布NFFT/2数据点 Am=2*abs(Y(1:NFFT/2)); plot(f,Am)
title('多音FM已调调频信号频谱')
xlabel('Frequency/Hz'),ylabel('magnitude') 图3-5-1
图3-5-2
图3-5-3
6) PM双音调制源程序
syms AA;
dt=0.00001; %产生取样步长 t=0.00001:dt:0.015;
am1=5;fm1=100; %设定调制信号基本参数 am2=2;fm2=150;
fc=1000; %产生画出载波信号
Vc=cos(2*pi*fc*AA); %载波信号
Mp=6; %设定调相指数
Vt=am1*cos(2*pi*fm1*AA)+am2*sin(2*pi*fm2*AA); %调制信号
Va=cos(2*pi*fc*AA+Mp*Vt); %对载波信号微分 figure(1)
plot(t, subs(Vt,AA,t)); xlabel('t'); ylabel('Vt');
title('多音PM调制信号');
figure(2)
plot(t, subs(Vc,AA,t)) xlabel('t');
ylabel('Vc');
title('多音PM载波信号');
figure(3)
plot(t, subs(Va,AA,t)) xlabel('t'); ylabel('Va');
title('多音PM调相已调波信号'); figure(4)
Fs=600; %采样频率;
T=1/Fs; %采样时间步长;
L=2000; %数据长度 t=(0:L-1)*T; %时间序列
y= am1*cos(2*pi*fm1*t)+am2*sin(2*pi*fm2*t); NFFT=L; %y数据长度即为L
Y=fft(y,NFFT)/L;
f=Fs/2*linspace(0,1,NFFT/2); %在0-Fs/2之间,等间距分布NFFT/2数据点 Am=2*abs(Y(1:NFFT/2)); plot(f,Am)
title('多音PM调制信号频谱')
xlabel('Frequency/Hz'),ylabel('magnitude') Fs=4000; %采样频率; T=1/Fs; %采样时间步长; L=2000; %数据长度 t=(0:L-1)*T; %时间序列 y=cos(2*pi*fc*AA+Mp*Vt);
y=subs(y,AA,t);
NFFT=L; %y数据长度即为L Y=fft(y,NFFT)/L;
f=Fs/2*linspace(0,1,NFFT/2); %在0-Fs/2之间,等间距分布NFFT/2数据点 Am=2*abs(Y(1:NFFT/2));
figure(5) plot(f,Am)
title('多音PM已调调相信号频谱')
xlabel('Frequency/Hz'),ylabel('magnitude') 图3-6-1
图3-6-2
% hObject handle to pushbutton11 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
dt=1/1000; %????¨????¨??????
t=0:dt:1.5 %????¨??????????§????§??????ì fm=5; %¨????¨??????????§???? mt=square(2*pi*fm*t,50); %¨?????????? fc=50; %??????§
ct=cos(2*pi*fc*t); %??????§????¨?????? kf=100; %¨????¨??????????§???? int_mt(1)=0;
for i=1:length(t)-1
int_mt(i+1)=int_mt(i)+mt(i)*dt; %¨??????m(t)??????§????§ end %????¨??????¨?????????? vt=cos(2*pi*fc*t+kf*int_mt); %??
plot(vt);
axis([0,1500,-1.2,1.2]); title('????????¨????');
% --- Executes on button press in pushbutton12.
function pushbutton12_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton12 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
dt=1/1000; %????¨????¨??????
t=0:dt:1.5 %????¨??????????§????§??????ì fm=5; %¨????¨??????????§???? mt=square(2*pi*fm*t,50); %¨?????????? fc=50; %??????§
ct=cos(2*pi*fc*t); %??????§????¨?????? kf=100; %¨????¨??????????§???? int_mt(1)=0;
for i=1:length(t)-1
int_mt(i+1)=int_mt(i)+mt(i)*dt; %¨??????m(t)??????§????§ end %????¨??????¨?????????? vt=cos(2*pi*fc*t+kf*int_mt); %??
vt1=vt;
for i=1:length(t)-1 %??????§??????§????§????¨??????
diff_vt1(i)=(vt1(i+1)-vt1(i))/dt;
end
diff_vt2 = abs(hilbert(diff_vt1)); %hilbert????¨????????????????§????§¨????????????§????¨??????¨????????????§
zero=(max(diff_vt2)-min(diff_vt2))/2; diff_vt3=diff_vt2-zero;
plot((1:length(diff_vt3))/1000,diff_vt3/400); title('????????¨????');
% --- Executes on button press in pushbutton13.
function pushbutton13_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton13 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) dt=1/1000; %????¨????¨??????
t=0:dt:1.5 %????¨??????????§????§??????ì fm=5; %¨????¨??????????§???? mt=square(2*pi*fm*t,50); %¨?????????? fc=50; %??????§
ct=cos(2*pi*fc*t); %??????§????¨?????? kf=100; %¨????¨??????????§???? int_mt(1)=0;
for i=1:length(t)-1
int_mt(i+1)=int_mt(i)+mt(i)*dt; %¨??????m(t)??????§????§ end %????¨??????¨?????????? vt=cos(2*pi*fc*t+kf*int_mt); %??
vt1=vt;
for i=1:length(t)-1 %??????§??????§????§????¨?????? diff_vt1(i)=(vt1(i+1)-vt1(i))/dt; end
diff_vt2 abs(hilbert(diff_vt1)); %hilbert????¨????????????????§????§¨????????????§????¨??????¨????????????§
zero=(max(diff_vt2)-min(diff_vt2))/2; diff_vt3=diff_vt2-zero;
Fs=20; %¨????¨?????? T=1/Fs; %????¨????¨??????
N=1024; %??????ì????ì t=(0:N-1)*T; %????¨????
fm=5; %¨????¨??????????§????¨??????
= mt=square(2*pi*fm*t,50); %¨??????????
NFFT=N; %??????ì????ìN Y=fft(mt,NFFT)/N;
f=Fs/2*linspace(0,1,NFFT/2); %0-Fs/2¨????????§????§??????§????§NFFT/2 Am=2*abs(Y(1:NFFT/2)); plot(f,Am) title('????')
xlabel('Frequency/Hz'),ylabel('magnitude')
% --- Executes on button press in pushbutton14.
function pushbutton14_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton14 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) dt=1/1000; %????¨????¨??????
t=0:dt:1.5 %????¨??????????§????§??????ì fm=5; %¨????¨??????????§???? mt=square(2*pi*fm*t,50); %¨?????????? fc=50; %??????§
ct=cos(2*pi*fc*t); %??????§????¨??????
kf=100; %¨????¨??????????§???? int_mt(1)=0;
for i=1:length(t)-1
int_mt(i+1)=int_mt(i)+mt(i)*dt; %¨??????m(t)??????§????§ end %????¨??????¨?????????? vt=cos(2*pi*fc*t+kf*int_mt); %??
vt1=vt;
for i=1:length(t)-1 %??????§??????§????§????¨?????? diff_vt1(i)=(vt1(i+1)-vt1(i))/dt; end
diff_vt2 abs(hilbert(diff_vt1)); %hilbert????¨????????????????§????§¨????????????§????¨??????¨????????????§
zero=(max(diff_vt2)-min(diff_vt2))/2; diff_vt3=diff_vt2-zero;
Fs=20; %¨????¨?????? T=1/Fs; %????¨????¨?????? N=1024; %??????ì????ì t=(0:N-1)*T; %????¨????
fm=5; %¨????¨??????????§????¨?????? mt=square(2*pi*fm*t,50); %¨?????????? NFFT=N; %??????ì????ìN
= Y=fft(mt,NFFT)/N;
f=Fs/2*linspace(0,1,NFFT/2); %0-Fs/2¨????????§????§??????§????§NFFT/2 Am=2*abs(Y(1:NFFT/2));
Fs=20; %¨??????
T=1/Fs; %¨????????????????ì????ì N=1024; %??????ì????ì
t=(0:N-1)*T;
fm=5; %¨????¨??????????§???? mt=square(2*pi*fm*t,50); %¨?????????? NFFT=N; %??????ì????ìN Y=fft(vt,NFFT)/N;
f=Fs/2*linspace(0,1,NFFT/2); %0-Fs/2¨????????§????§??????§????§NFFT/2 Am=2*abs(Y(1:NFFT/2)); plot(f,Am) title('????')
xlabel('Frequency/Hz'),ylabel('magnitude')
% --- Executes on button press in pushbutton15.
function pushbutton15_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton15 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton16.
function pushbutton16_Callback(hObject, eventdata, handles) % hObject handle to pushbutton16 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA) dt=0.001; %??????ì????ì??¨????????????????????§????§ t=0:dt:1.5; %??????ì??????ì????????????ì??
am=15; %??????ì????ì??¨??????????????????¨??¨??????ì??????????????????ì????
fm=5; %??????ì????ì??¨????????????????????????????????????????ì???? mt=am*cos(2*pi*fm*t); fc=10; %??????ì????ì??¨??????????¨??????????????????????????ì????
ct=cos(2*pi*fc*t); %??????ì??????????¨????
kp=1; %??????ì????ì??¨????????????ì¨??¨?????????? vt=cos(2*pi*fc*t+kp*mt);
plot(t,ct);
%????????????????ì??????ì??????????????
%??????ì??????????????????
title('??????¨????????????????????????ì????');
% --- Executes on button press in pushbutton17.
function pushbutton17_Callback(hObject, eventdata, handles) % hObject handle to pushbutton17 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) dt=0.001; t=0:dt:1.5;
%??????ì????ì??¨????????????????????§????§ %??????ì??????ì????????????ì????
am=15; %??????ì????ì??¨??????????????????¨??¨??????ì??????????????????ì????
fm=5; %??????ì????ì??¨????????????????????????????????????????ì???? mt=am*cos(2*pi*fm*t); fc=10;
%??????ì??????????????????
%??????ì????ì??¨??????????¨??????????????????????????ì????
ct=cos(2*pi*fc*t); %??????ì??????????¨????
kp=1; %??????ì????ì??¨????????????ì¨??¨?????????? vt=cos(2*pi*fc*t+kp*mt);
plot(t,vt);
title('??????????????????????????ì????');
% --- Executes on button press in pushbutton18.
function pushbutton18_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton18 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) dt=0.001; t=0:dt:1.5;
%??????ì????ì??¨????????????????????§????§ %??????ì??????ì????????????ì????
%????????????????ì??????ì??????????????
am=15; %??????ì????ì??¨??????????????????¨??¨??????ì??????????????????ì????
fm=5; %??????ì????ì??¨????????????????????????????????????????ì???? mt=am*cos(2*pi*fm*t); %??????ì?????????????????? fc=10; %??????ì????ì??¨??????????¨??????????????????????????ì????
ct=cos(2*pi*fc*t);
%??????ì??????????¨????
kp=1; %??????ì????ì??¨????????????ì¨??¨?????????? vt=cos(2*pi*fc*t+kp*mt); %????????????????ì??????ì?????????????? am=15; %??????ì????ì??¨??????????????????¨??¨??????ì??????????????????ì????
fm=5; %??????ì????ì??¨???????????????????????
ì????
mt=am*cos(2*pi*fm*t); fc=10; %??????ì????ì??¨??????????¨??????????????????????????ì????
ct=cos(2*pi*fc*t); kf=1; vt=cos(2*pi*fc*t+kp*mt);
Fs=20; %??????????ì???????????? T=1/Fs; %??????????ì???????????? N=1024; %??????????????§????§???? t=(0:N-1)*T; %????????????ì????
mt=am*cos(2*pi*fm*t); NFFT=N; %??????????????§????§????????????N Y=fft(mt,NFFT)/N;
f=Fs/2*linspace(0,1,NFFT/2); %??0-Fs/2??????????????????????????ì¨??¨??¨??¨????????NFFT/2??????
Am=2*abs(Y(1:NFFT/2)); plot(f,Am)
title('??????????')
xlabel('Frequency/Hz'),ylabel('magnitude')
% --- Executes on button press in pushbutton19.
function pushbutton19_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton19 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) dt=0.001; t=0:dt:1.5;
%??????ì????ì??¨????????????????????§????§ %??????ì??????ì????????????ì????
%??????ì??????????????????
%??????ì??????????¨????
%??????ì????ì??¨??????????????????
%????????????????ì??????ì??????????????
am=15; %??????ì????ì??¨??????????????????¨??¨??????ì??????????????????ì????
fm=5; %??????ì????ì??¨????????????????????????????????????????ì???? mt=am*cos(2*pi*fm*t); %??????ì?????????????????? fc=10; %??????ì????ì??¨??????????¨??????????????????????????ì????
ct=cos(2*pi*fc*t);
%??????ì??????????¨????
kp=1; %??????ì????ì??¨????????????ì¨??¨?????????? vt=cos(2*pi*fc*t+kp*mt); %????????????????ì??????ì?????????????? am=15; %??????ì????ì??¨??????????????????¨??¨??????ì??????????????????ì????
fm=5; %??????ì????ì??¨????????????????????????????????????????
ì????
mt=am*cos(2*pi*fm*t); fc=10; %??????ì????ì??¨??????????¨??????????????????????????ì????
ct=cos(2*pi*fc*t); kf=1; vt=cos(2*pi*fc*t+kp*mt);
Fs=20; %??????????ì???????????? T=1/Fs; %??????????ì???????????? N=1024; %??????????????§????§???? t=(0:N-1)*T; %????????????ì????
mt=am*cos(2*pi*fm*t); NFFT=N; %??????????????§????§????????????N Y=fft(mt,NFFT)/N;
f=Fs/2*linspace(0,1,NFFT/2); %??0-Fs/2??????????????????????????ì¨??¨??¨??¨????????NFFT/2??????
Am=2*abs(Y(1:NFFT/2));
Fs=200; %??????????ì????????????
T=1/Fs; %??????????ì????????????????§????§???? N=1024; %??????????????§????§???? t=(0:N-1)*T; %????????????ì???? vt=cos(2*pi*fc*t+kp*mt);
NFFT=N; %??????????????§????§????????????N
Y=fft(vt,NFFT)/N;
f=Fs/2*linspace(0,1,NFFT/2); %??0-Fs/2??????????????????????????ì¨??¨??¨??¨????????NFFT/2??????
Am=2*abs(Y(1:NFFT/2)); plot(f,Am)
title('??????????')
xlabel('Frequency/Hz'),ylabel('magnitude')
% --- Executes on button press in pushbutton20.
function pushbutton20_Callback(hObject, eventdata, handles) % hObject handle to pushbutton20 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) dt=0.001; t=0:dt:1.5;
%??????ì????ì??¨????????????????????§????§ %??????ì??????ì????????????ì????
%??????ì??????????????????
%??????ì??????????¨????
%??????ì????ì??¨??????????????????
%????????????????ì??????ì??????????????
am=15; %??????ì????ì??¨??????????????????¨??¨??????ì??????????????????ì????
fm=5; %??????ì????ì??¨????????????????????????????????????????ì????
mt=am*cos(2*pi*fm*t); %??????ì??????????????????
fc=10; %??????ì????ì??¨??????????¨??????????????????????????ì????
ct=cos(2*pi*fc*t); %??????ì??????????¨????
kp=1; %??????ì????ì??¨????????????ì¨??¨?????????? vt=cos(2*pi*fc*t+kp*mt); %????????????????ì??????ì??????????????
am=15; %??????ì????ì??¨??????????????????¨??¨??????ì??????????????????ì????
fm=5; %??????ì????ì??¨????????????????????????????????????????ì????
mt=am*cos(2*pi*fm*t); fc=10; %??????ì????ì??¨??????????¨??????????????????????????ì????ct=cos(2*pi*fc*t); kf=1; vt=cos(2*pi*fc*t+kp*mt);
Fs=20; %??????????ì????????????T=1/Fs; %??????????ì????????????N=1024; %?????????§????§????t=(0:N-1)*T; %????????????ì????mt=am*cos(2*pi*fm*t); NFFT=N; %??????????????§????§????????????NY=fft(mt,NFFT)/N;
f=Fs/2*linspace(0,1,NFFT/2); %??0-/2??????
Am=2*abs(Y(1:NFFT/2));
Fs=200; %??????????ì????????????T=1/Fs; %??????????ì????????????????§????§????N=1024; %??????????????§????§????t=(0:N-1)*T; %????????????ì????vt=cos(2*pi*fc*t+kp*mt);
NFFT=N; %??????????????§????§????????????NY=fft(vt,NFFT)/N;
f=Fs/2*linspace(0,1,NFFT/2); %??0-/2??????
Am=2*abs(Y(1:NFFT/2));
dt=1/2000; %??????ì????ì??¨????????????????????§????§t=0:dt:2; %??????ì??????ì????????????ì????am=10; ??????ì????
fm=3; %??????ì????ì??¨????????????????????????????????????????ì????mt=am*cos(2*pi*fm*t); %??????ì??????????????????
Fs/2??????????????????????????ì¨??¨??¨??¨????????NFFT
Fs/2??????????????????????????ì¨??¨??¨??¨????????NFFT%??????ì????ì??¨??????????????????¨??¨??????ì???????????? %??????ì??????????????????
%??????ì??????????¨????
%??????ì????ì??¨??????????????????
%????????????????ì??????ì??????????????
fc=30; %??????ì????ì??¨??????????¨??????????????????????????ì????
ct=cos(2*pi*fc*t); %??????ì??????????¨????
kp=1; %??????ì????ì??¨?????????????????? vt=cos(2*pi*fc*t+kp*mt); %????????????????ì??????ì??????????????
vt1=vt;
for i=1:length(t)-1 %??????????????????¨????????????¨??¨????????????????ì diff_vt1(i)=(vt1(i+1)-vt1(i))/dt; end diff_vt2
??????ì??¨????????
zero=(max(diff_vt2)-min(diff_vt2))/2; diff_vt3=diff_vt2-zero;
plot((1:length(diff_vt3))/2000,diff_vt3/100); title('??????????????????????????ì????');
% --- Executes on button press in pushbutton21.
function pushbutton21_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton21 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA) dt=0.001; %??????ì????ì??¨????????????????????§????§ t=0:dt:1.5; %??????ì??????ì????????????ì???? am=15; %??????ì????ì??¨??????????????????¨??¨??????ì??????????????????ì????
fm=5; %??????ì????ì??¨????????????????????????????????????????ì???? mt=am*cos(2*pi*fm*t); %??????ì????????????????? fc=10; %??????ì????ì??¨??????????¨??????????????????????????ì???? ct=cos(2*pi*fc*t);
%??????ì??????????¨????
kp=1; %??????ì????ì??¨????????????ì¨??¨?????????? vt=cos(2*pi*fc*t+kp*mt); %??????????ì??????ì??????????????
plot(t,mt);
title('??????????????????????????ì????');
=
abs(hilbert(diff_vt1)); %hilbert????????????????ì??????????????????????????¨??¨??????ì??????¨????????ì????
% --- Executes on button press in pushbutton22.
function pushbutton22_Callback(hObject, eventdata, handles) % hObject handle to pushbutton22 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) dt=0.001; t=0:dt:1.5;
%????§????§????ì¨??¨?? %????§????§????§????
fm=5; %????§????§????ì????§ mt=square(2*pi*fm*t,50); %????§
fc=10; ct=cos(2*pi*fc*t);
%????§????§????ì????ì????§ %????§????ì
kp=2; %????§????§????ì????§????ì??ì vt=cos(2*pi*fc*t+kp*mt); %????§????§
plot(mt);
axis([0,1500,-1.5,1.5]); title('????§????');
% --- Executes on button press in pushbutton23.
function pushbutton23_Callback(hObject, eventdata, handles) % hObject handle to pushbutton23 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) dt=0.001; %¨??¨??????§????????ì??ì t=0:dt:1.5; %¨????¨????????¨?? fm=5; %¨??¨??????§????¨???? mt=square(2*pi*fm*t,50); %¨????????
fc=10; ct=cos(2*pi*fc*t); vt=cos(2*pi*fc*t+kp*mt); plot(ct);
axis([0,1500,-1,1]); title('????§????¨??');
%¨??¨??????§????§¨???? %¨????????§
kp=2; %¨??¨??????§????¨????§??§
%????¨????¨????????
% --- Executes on button press in pushbutton24.
function pushbutton24_Callback(hObject, eventdata, handles) % hObject handle to pushbutton24 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) dt=0.001; %????ì??ì??¨????????????????§??§ t=0:dt:1.5;
%????ì????ì??????????ì????
fm=5; %????ì??ì??¨????????????????????????????????????ì????mt=square(2*pi*fm*t,50); %????ì??????????????????
fc=10; %????ì??ì??¨????????¨??????????????????????ì????ct=cos(2*pi*fc*t);
%????ì??????????¨??
kp=2; %????ì??ì??¨????????쨨???????? vt=cos(2*pi*fc*t+kp*mt); %??????????????ì????ì??????????????
plot(vt);
axis([0,1500,-1.2,1.2]); title('????????????????????????ì????');
% --- Executes on button press in pushbutton25.
function pushbutton25_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton25 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) dt=0.001; %??§??§??쨨 t=0:dt:1.5;
%??§??§??§????
fm=5; %??§??§??ì??§ mt=square(2*pi*fm*t,50); %??§
fc=10; %??§??§??ì??ì??§ ct=cos(2*pi*fc*t);
%??§??ì
kp=2; %??§??§??ì??§??è vt=cos(2*pi*fc*t+kp*mt); %??§??§
am=15; %??§??§??ì??è??§??§ fm=5; %??§??§??ì??§ mt=square(2*pi*fm*t,50); %??§
fc=10; %??§??§??ì??ì??§ ct=cos(2*pi*fc*t); %??§??ì kp=2; %??§??§??ì vt=cos(2*pi*fc*t+kp*mt); %??§??§
Fs=20; %??§ T=1/Fs; %??§ N=1024; %¨¨ t=(0:N-1)*T; %??§????
mt=square(2*pi*fm*t,50); %??§
NFFT=N; %¨¨N
Y=fft(mt,NFFT)/N;
f=Fs/2*linspace(0,1,NFFT/2); %0-Fs/2??§??è??èNFFT/2 Am=2*abs(Y(1:NFFT/2)); plot(f,Am)
title('')
xlabel('Frequency/Hz'),ylabel('magnitude')
% --- Executes on button press in pushbutton26.
function pushbutton26_Callback(hObject, eventdata, handles) % hObject handle to pushbutton26 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) dt=0.001; %¨¨??§??????è t=0:dt:1.5; %¨??¨??????¨? fm=5; %¨¨??§????¨?? mt=square(2*pi*fm*t,50); %¨??????
fc=10;
%¨¨??§??§¨??
ct=cos(2*pi*fc*t); %¨????§ kp=2; %¨¨??§????¨¤ vt=cos(2*pi*fc*t+kp*mt);
am=15; %¨¨??§??????¤¨??¨?? fm=5; %¨¨??§????¨?? mt=square(2*pi*fm*t,50); %¨??????
fc=10; %¨¨??§??§¨?? ct=cos(2*pi*fc*t); %¨????§ kp=2; %¨¨??§????
%????¨??¨??????
vt=cos(2*pi*fc*t+kp*mt);
Fs=20; %¨?? T=1/Fs; %¨??
%????¨??¨??????
N=1024; %??è
t=(0:N-1)*T; %????¨?
mt=square(2*pi*fm*t,50); %¨?????? NFFT=N; %??èN Y=fft(mt,NFFT)/N;
f=Fs/2*linspace(0,1,NFFT/2); %0-Fs/2¨¤??¤NFFT/2 Am=2*abs(Y(1:NFFT/2));
Fs=200; %¨?? T=1/Fs; %¨????????è N=1024; %??è
t=(0:N-1)*T; %????¨? vt=cos(2*pi*fc*t+kp*mt); NFFT=N; %??èN
%????¨??¨??????
Y=fft(vt,NFFT)/N;
f=Fs/2*linspace(0,1,NFFT/2); %0-Fs/2¨¤??¤NFFT/2 Am=2*abs(Y(1:NFFT/2)); plot(f,Am)
title('????')
xlabel('Frequency/Hz'),ylabel('magnitude')
% --- Executes on button press in pushbutton27.
function pushbutton27_Callback(hObject, eventdata, handles) % hObject handle to pushbutton27 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) dt=0.001;
%??è??¨??a??????????¤
t=0:dt:1.5; %??ò??ò??a???????????
fm=5; %??è??¨??e??????????????????????????????ó???? mt=square(2*pi*fm*t,50); %??ò??????e????????????
fc=10; %??è??¨??????¨??????????????????ó???? ct=cos(2*pi*fc*t); %??ò??????????¨ kp=2; %??è??¨??e??-????????
vt=cos(2*pi*fc*t+kp*mt); %??e??????????ò??ò??????e????????
am=15; %??è??¨??e????????????????????????????ó???? fm=5; %??è??¨??e??????????????????????????????ó???? mt=square(2*pi*fm*t,50); %??ò??????e????????????
fc=10; %??è??¨??????¨??????????????????ó?? ct=cos(2*pi*fc*t); %??ò??????????¨ kp=2; vt=cos(2*pi*fc*t+kp*mt);
Fs=20; %???????????????????T=1/Fs; %???????????????????N=1024; %??????????¤????
t=(0:N-1)*T; %??a???????????mt=square(2*pi*fm*t,50); NFFT=N; %??????????¤????????????NY=fft(mt,NFFT)/N;
f=Fs/2*linspace(0,1,NFFT/2); %??0-Am=2*abs(Y(1:NFFT/2));
Fs=200; %???????????????????T=1/Fs; %?????????a??????????¤????N=1024; %??????????¤???? t=(0:N-1)*T; %??a???????????vt=cos(2*pi*fc*t+kp*mt);
NFFT=N; %??????????¤????????????NY=fft(vt,NFFT)/N;
f=Fs/2*linspace(0,1,NFFT/2); %??0-Am=2*abs(Y(1:NFFT/2));
dt=0.001; t=0:dt:1.5;
am=15; %??è??¨??e????????????????????????????ó????fm=5; %??è??¨??e??????????????????????????????ó????mt=square(2*pi*fm*t,50); fc=5; ct=cos(2*pi*fc*t); %??è??¨??e????????????
%??e??????????ò??ò??????e???????? %??ò??????e???????????? Fs/2??????????????????????-???????NFFT/2???????????? %??e??????????ò??ò??????e?????
Fs/2??????????????????????-???????NFFT/2???????????? %??è??¨??a??????????¤ %??ò??ò??a???????????
%??ò??????e????????????
%??è??¨??????¨??????????????????ó???? %??ò??????????¨
kp=1; %??è??¨??e????????????
vt=cos(2*pi*fc*t+kp*mt); %??e??????????ò??ò??????e????????
vt1=vt;
for i=1:length(t)-1 %??????????????????¨?????????????e??????í diff_vt1(i)=(vt1(i+1)-vt1(i))/dt; end
diff_vt2 = abs(hilbert(diff_vt1)); %hilberta???????????????????????????????????????a????????¨?ó??????ì??¨???
zero=(max(diff_vt2)-min(diff_vt2))/2; diff_vt3=diff_vt2-zero;
plot(mt);
axis([0,1500,-1.5,1.5]);
title('??????e??????????????a???????');
% --- Executes on button press in pushbutton30.
function pushbutton30_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton30 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) syms AA;
dt=0.000001; %产生并画出调制信号 t=0.000001:dt:0.015;
am1=5;fm1=100; %设定调制信号基本参数 am2=2;fm2=150;
fc=1000; %产生画出载波信号 Vc=cos(2*pi*fc*AA);
Mf=40; %设定调频指数 Kf=Mf*fm2/am2; fmax=fm2*Mf;
Vt=am1*cos(2*pi*fm1*AA)+am2*cos(2*pi*fm2*AA); %调制信号 intf=int(Vt,AA)
Va=cos(2*pi*fc*AA+Kf*intf) %对载波信号积分
subplot(3,1,1),plot(t, subs(Vt,AA,t)); xlabel('t');
ylabel('Vt');
title('多音FM调制信号');
subplot(3,1,2),plot(t, subs(Vc,AA,t));
xlabel('t');
ylabel('Vc');
title('多音FM载波信号');
subplot(3,1,3),plot(t, subs(Va,AA,t)); xlabel('t');
ylabel('Va');
title('多音FM调频已调波信号');
Fs=600; %采样频率; T=1/Fs; %采样时间步长; L=2000; %数据长度
t=(0:L-1)*T; %时间序列
y= am1*cos(2*pi*fm1*t)+am2*sin(2*pi*fm2*t); NFFT=L; %y数据长度即为L Y=fft(y,NFFT)/L;
f=Fs/2*linspace(0,1,NFFT/2); %在0-Fs/2之间,等间距分布NFFT/2数据点 Am=2*abs(Y(1:NFFT/2)); plot(f,Am)
title('多音FM调制信号频谱')
xlabel('Frequency/Hz'),ylabel('magnitude')
Fs=4000; %采样频率;
T=1/Fs; %采样时间步长; L=2000; %数据长度 t=(0:L-1)*T; %时间序列 y=cos(2*pi*fc*AA+Kf*intf); y=subs(y,AA,t);
NFFT=L; %y数据长度即为L
Y=fft(y,NFFT)/L;
f=Fs/2*linspace(0,1,NFFT/2); %在0-Fs/2之间,等间距分布NFFT/2数据点 Am=2*abs(Y(1:NFFT/2)); plot(f,Am)
title('多音FM已调调频信号频谱')
xlabel('Frequency/Hz'),ylabel('magnitude')
2) 多音
function varargout = duoyin(varargin) % DUOYIN M-file for duoyin.fig
% DUOYIN, by itself, creates a new DUOYIN or raises the existing % singleton*. %
% H = DUOYIN returns the handle to a new DUOYIN or the handle to % the existing singleton*. %
% DUOYIN('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in DUOYIN.M with the given input arguments. %
% DUOYIN('Property','Value',...) creates a new DUOYIN or raises the
% existing singleton*. Starting from the left, property value pairs are % applied to the GUI before duoyin_OpeningFunction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to duoyin_OpeningFcn via varargin. %
% *See GUI Options on GUIDE's Tools menu. Choose \% instance to run (singleton)\%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Copyright 2002-2003 The MathWorks, Inc.
% Edit the above text to modify the response to help duoyin
% Last Modified by GUIDE v2.5 04-Jan-2013 08:54:49
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @duoyin_OpeningFcn, ... 'gui_OutputFcn', @duoyin_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []); if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1}); end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else
gui_mainfcn(gui_State, varargin{:}); end
% End initialization code - DO NOT EDIT
% --- Executes just before duoyin is made visible.
function duoyin_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn. % hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % varargin command line arguments to duoyin (see VARARGIN)
% Choose default command line output for duoyin handles.output = hObject;
% Update handles structure guidata(hObject, handles);
% UIWAIT makes duoyin wait for user response (see UIRESUME) % uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line. function varargout = duoyin_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure varargout{1} = handles.output;
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) syms AA;
dt=0.000001; %??????§??????§
t=0.000001:dt:0.015;
am1=5;fm1=100; %??????§??????§??????ì??????§ am2=2;fm2=150;
fc=1000; %??????§??????§??????ì Vc=cos(2*pi*fc*AA);
Mf=40; %??????§??????§??????ì Kf=Mf*fm2/am2;
fmax=fm2*Mf;
Vt=am1*cos(2*pi*fm1*AA)+am2*cos(2*pi*fm2*AA); %
intf=int(Vt,AA)
Va=cos(2*pi*fc*AA+Kf*intf) %??????ì??????ì????ì plot(t, subs(Vt,AA,t)); xlabel('t');
ylabel('Vt');
title('??????§??????ì????ìFM');
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles) % hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) syms AA;
dt=0.000001; %¨??????¨?????????? t=0.000001:dt:0.015;
am1=5;fm1=100; %¨????¨??????????§????¨?????????? am2=2;fm2=150;
fc=1000; %¨??????¨????????????§ Vc=cos(2*pi*fc*AA);
Mf=40; %¨????¨??????????§????
Kf=Mf*fm2/am2;
fmax=fm2*Mf;
Vt=am1*cos(2*pi*fm1*AA)+am2*cos(2*pi*fm2*AA); %?? intf=int(Vt,AA)
Va=cos(2*pi*fc*AA+Kf*intf) %??????§??????§????§
plot(t, subs(Vc,AA,t)); xlabel('t'); ylabel('Vc');
title('¨????????§????§FM??????§');
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles) % hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) syms AA;
dt=0.000001; %??????ì??????ì?????????????????????????? t=0.000001:dt:0.015;
am1=5;fm1=100; %??????ì????ì??¨????????????????????????ì?????????? am2=2;fm2=150;
fc=1000; %??????ì??????ì??????????????¨???????????? Vc=cos(2*pi*fc*AA);
Mf=40; %??????ì????ì??¨?????????????????? Kf=Mf*fm2/am2;
fmax=fm2*Mf;
Vt=am1*cos(2*pi*fm1*AA)+am2*cos(2*pi*fm2*AA); %???????
intf=int(Vt,AA)
Va=cos(2*pi*fc*AA+Kf*intf) %??????????¨????????????????¨??¨????
plot(t, subs(Va,AA,t)); xlabel('t'); ylabel('Va');
title('??????ì¨??¨??????FM??????????????¨????????????');
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库信号与线性系统课程设计在线全文阅读。
相关推荐: