matlab模拟am,fm,dsb,ssb,pm信号调制附GUI界面
✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。
🍎个人主页:Matlab科研工作室
🍊个人信条:格物致知。
⛄ 内容介绍
AM(Amplitude Modulation)调制是一种常见的模拟调制技术,通过改变载波信号的幅度来传输基带信号。在AM调制中,基带信号被乘以一个高频载波信号,产生一个带有两个边带的调制信号。这两个边带位于载波频率的上下方。
FM(Frequency Modulation)调制是一种模拟调制技术,通过改变载波信号的频率来传输基带信号。在FM调制中,基带信号被用于调制载波信号的频率,使得载波频率在基带信号变化时发生相应的变化。这种调制方式产生一个带宽较宽的调制信号,其中包含了无限多个边带。
DSB(Double Sideband)调制是一种模拟调制技术,它将基带信号的全部频谱复制到两个边带中,同时去除了载波信号。DSB调制产生的信号带宽较大,效率较低,因为它需要传输整个基带信号的频谱。
SSB(Single Sideband)调制是一种模拟调制技术,它只传输基带信号的一个边带,而另一个边带和载波信号被抑制或抑制得非常弱。SSB调制可以提高信号的带宽利用率,并减少功率消耗。
PM(Phase Modulation)调制是一种模拟调制技术,它通过改变载波信号的相位来传输基带信号。在PM调制中,基带信号被用于调制载波信号的相位,使得载波相位在基带信号变化时发生相应的变化。PM调制产生的调制信号带宽较宽,但相对于FM调制,它的抗干扰性更好。
这些调制方式在无线通信、广播、电视等领域中被广泛应用,每种调制方式具有不同的特点和适用场景。
⛄ 部分代码
function varargout = dsb(varargin)
% DSB MATLAB code for dsb.fig
% DSB, by itself, creates a new DSB or raises the existing
% singleton*.
%
% H = DSB returns the handle to a new DSB or the handle to
% the existing singleton*.
%
% DSB('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in DSB.M with the given input arguments.
%
% DSB('Property','Value',...) creates a new DSB or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before dsb_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to dsb_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help dsb
% Last Modified by GUIDE v2.5 26-Feb-2020 23:48:18
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @dsb_OpeningFcn, ...
'gui_OutputFcn', @dsb_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 dsb is made visible.
function dsb_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 dsb (see VARARGIN)
% Choose default command line output for dsb
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes dsb wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = dsb_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;
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double
% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit2_Callback(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit2 as text
% str2double(get(hObject,'String')) returns contents of edit2 as a double
% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit3_Callback(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit3 as text
% str2double(get(hObject,'String')) returns contents of edit3 as a double
% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit4_Callback(hObject, eventdata, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit4 as text
% str2double(get(hObject,'String')) returns contents of edit4 as a double
% --- Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit5_Callback(hObject, eventdata, handles)
% hObject handle to edit5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit5 as text
% str2double(get(hObject,'String')) returns contents of edit5 as a double
% --- Executes during object creation, after setting all properties.
function edit5_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit6_Callback(hObject, eventdata, handles)
% hObject handle to edit6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit6 as text
% str2double(get(hObject,'String')) returns contents of edit6 as a double
% --- Executes during object creation, after setting all properties.
function edit6_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit7_Callback(hObject, eventdata, handles)
% hObject handle to edit7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit7 as text
% str2double(get(hObject,'String')) returns contents of edit7 as a double
% --- Executes during object creation, after setting all properties.
function edit7_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit8_Callback(hObject, eventdata, handles)
% hObject handle to edit8 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit8 as text
% str2double(get(hObject,'String')) returns contents of edit8 as a double
% --- Executes during object creation, after setting all properties.
function edit8_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit8 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit9_Callback(hObject, eventdata, handles)
% hObject handle to edit9 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit9 as text
% str2double(get(hObject,'String')) returns contents of edit9 as a double
% --- Executes during object creation, after setting all properties.
function edit9_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit9 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit10_Callback(hObject, eventdata, handles)
% hObject handle to edit10 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit10 as text
% str2double(get(hObject,'String')) returns contents of edit10 as a double
% --- Executes during object creation, after setting all properties.
function edit10_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit10 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- 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)
global stype domain ;
f0=str2double(get(handles.edit1,'string'));
fc=str2double(get(handles.edit2,'string'));
fs=str2double(get(handles.edit3,'string'));
t=[0:0.000001:0.004];
s = audioread('data.wav');
s = s(:,1);
s = s';
pos = 4.4e4;
s=s(pos:pos length(t)-1);
if stype == 0
am1=cos(2*pi*f0*t); %信息信号
else am1 = s;
end
t=[0:0.000001:0.004];
am=am1; %信息信号
t1=cos(2*pi*fc*t); %载波
s_am=am.*t1; %DSB
%figure(1)
snr=get(handles.edit4,'String');; %加噪
snr=str2num(snr);
y=awgn(s_am,snr);
%snr=noise; %加噪
y=awgn(s_am,snr);
a=str2double(get(handles.edit5,'string'));
b=str2double(get(handles.edit6,'string'));
c=str2double(get(handles.edit7,'string'));
d=str2double(get(handles.edit8,'string'));
fsamp=1e6; %带通
fucts=[a b c d];
mags=[0 1 0];
devs=[0.05 0.01 0.05];
[n,Wn,beta,ftype]=kaiserord(fucts,mags,devs,fsamp);
hh=fir1(n,Wn,ftype,kaiser(n 1,beta),'noscale');
%figure(2)
% plot(f,abs(H));title('带通滤波器幅频特性'); axis([0 50000 0 1.4]);
%figure(3)
st_p=fftfilt(hh,y);
% subplot(2,1,1);plot(t,y); title('添加噪声后信号波形'); axis([0.002 0.004 -4 4]);
% subplot(2,1,2);plot(t,st_p); title('滤波后信号波形'); axis([0.002 0.004 -4 4]);
sp=s_am.*t1;
u=str2double(get(handles.edit9,'string'));
v=str2double(get(handles.edit10,'string'));
fsamp=1e6; %低通
fucts=[u v];
mags=[1 0];
devs=[0.01 0.05];
[n,Wn,beta,ftype]=kaiserord(fucts,mags,devs,fsamp);
hh=fir1(n,Wn,ftype,kaiser(n 1,beta),'noscale');
%figure(4)
[H,f]=freqz(hh,1,1024,fsamp);
% plot(f,abs(H));title('低通滤波器幅频特性'); axis([0 40000 0 2]);
%figure(5)
st_d=fftfilt(hh,sp);
% subplot(2,1,1);plot(t,sp); title('乘以载波以后信号波形'); axis([0.002 0.004 0 4]);
% subplot(2,1,2);plot(t,st_d); title('低通滤波以后解调出的波形'); axis([0.002 0.004 0 4]);
AM1=fft(am1);T1=fft(t1);S_AM=fft(s_am);Y=fft(y);ST_P=fft(st_p);SP=fft(sp);ST_D=fft(st_d);
f=(0:4000)*fs/4001-fs/2;
% figure(6)
% subplot(3,1,1);plot(f,fftshift(abs(AM1)));title('基带信号频谱'); axis([-40000 40000 0 2000]);
% subplot(3,1,2);plot(f,fftshift(abs(T1)));title('载波信号频谱'); axis([-40000 40000 0 2000]);
% subplot(3,1,3);plot(f,fftshift(abs(S_AM)));title('AM信号频谱'); axis([-40000 40000 0 2000]);
% figure(7)
% subplot(2,1,1);plot(f,fftshift(abs(Y)));title('噪声信号频谱'); axis([-40000 40000 0 3000]);
% subplot(2,1,2);plot(f,fftshift(abs(ST_P)));title('带通滤波后频谱'); axis([-40000 40000 0 4000]);
% figure(8)
% subplot(2,1,1);plot(f,fftshift(abs(SP)));title('乘以载波后信号频谱'); axis([-40000 40000 0 4000]);
% subplot(2,1,2);plot(f,fftshift(abs(ST_D)));title('解调得到信号频谱'); axis([-40000 40000 0 4000]);
if domain == 0
plot(handles.axes5,t,am1); title('基带波形');xlabel('t/s');
plot(handles.axes6,t,t1); title('载波信号');
plot(handles.axes7,t,s_am); title('DSB信号');
plot(handles.axes8,t,st_d);
else
plot(handles.axes5,f,fftshift(abs(AM1)));title('基带信号频谱'); axis([-40000 40000 0 2000]);
plot(handles.axes6,f,fftshift(abs(T1)));title('载波信号频谱'); axis([-40000 40000 0 2000]);
plot(handles.axes7,f,fftshift(abs(S_AM)));title('DSB信号频谱'); axis([-40000 40000 0 2000]);
if stype == 0
plot(handles.axes8,f,fftshift(abs(ST_D)));title('解调得到信号频谱'); axis([-40000 40000 0 2000]);
else
plot(handles.axes8,f,fftshift(abs(ST_D)));title('解调得到信号频谱'); axis([-40000 40000 0 3]);
end
end
% --- 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)
global stype domain dtype;
set(handles.edit1,'String',2000);
set(handles.edit2,'String',20000);
set(handles.edit3,'String',40000);
set(handles.edit4,'String',5);
set(handles.edit5,'String',16000);
set(handles.edit6,'String',17500);
set(handles.edit7,'String',22500);
set(handles.edit8,'String',24000);
set(handles.edit9,'String',3000);
set(handles.edit10,'String',20000);
set(handles.radiobutton1,'Value',1);
set(handles.radiobutton2,'Value',0);
stype = 0;
set(handles.radiobutton7,'Value',1);
set(handles.radiobutton8,'Value',0);
domain = 0;
% --- Executes on button press in radiobutton1.
function radiobutton1_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of radiobutton1
global stype;
set(handles.radiobutton1,'value',1);
set(handles.radiobutton2,'value',0);
stype=0;
% --- Executes on button press in radiobutton2.
function radiobutton2_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of radiobutton2
global stype;
set(handles.radiobutton1,'value',0);
set(handles.radiobutton2,'value',1);
stype=1;
% --- Executes on button press in radiobutton7.
function radiobutton7_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of radiobutton7
global domain;
set(handles.radiobutton7,'value',1);
set(handles.radiobutton8,'value',0);
domain=0;
% --- Executes on button press in radiobutton8.
function radiobutton8_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton8 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of radiobutton8
global domain;
set(handles.radiobutton7,'value',0);
set(handles.radiobutton8,'value',1);
domain=1;
% --- Executes on button press in radiobutton9.
function radiobutton9_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton9 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of radiobutton9
global dtype;
set(handles.radiobutton9,'value',1);
set(handles.radiobutton10,'value',0);
dtype=0;
% --- Executes on button press in radiobutton10.
function radiobutton10_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton10 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of radiobutton10
global dtype;
set(handles.radiobutton9,'value',0);
set(handles.radiobutton10,'value',1);
dtype=1;
⛄ 运行结果
编辑
编辑
编辑
编辑
编辑
编辑⛄ 参考文献
[1] 李光辉.信号调制方式自动识别的研究[D].西华大学[2023-07-15].
[2] 李红.基于Matlab的线性模拟调制技术研究[J].科技广场, 2010(7):3.DOI:10.3969/j.issn.1671-4792.2010.07.009.
⛳️ 代码获取关注我
❤️部分理论引用网络文献,若有侵权联系博主删除
❤️ 关注我领取海量matlab电子书和数学建模资料
🍅 仿真咨询
1.卷积神经网络(CNN)、LSTM、支持向量机(SVM)、最小二乘支持向量机(LSSVM)、极限学习机(ELM)、核极限学习机(KELM)、BP、RBF、宽度学习、DBN、RF、RBF、DELM实现风电预测、光伏预测、电池寿命预测、辐射源识别、交通流预测、负荷预测、股价预测、PM2.5浓度预测、电池健康状态预测、水体光学参数反演、NLOS信号识别、地铁停车精准预测、变压器故障诊断
2.图像识别、图像分割、图像检测、图像隐藏、图像配准、图像拼接、图像融合、图像增强、图像压缩感知
3.旅行商问题(TSP)、车辆路径问题(VRP、MVRP、CVRP、VRPTW等)、无人机三维路径规划、无人机协同、无人机编队、机器人路径规划、栅格地图路径规划、多式联运运输问题、车辆协同无人机路径规划
4.无人机路径规划、无人机控制、无人机编队、无人机协同、无人机任务分配
5.传感器部署优化、通信协议优化、路由优化、目标定位
6.信号识别、信号加密、信号去噪、信号增强、雷达信号处理、信号水印嵌入提取、肌电信号、脑电信号
7.生产调度、经济调度、装配线调度、充电优化、车间调度、发车优化、水库调度、三维装箱、物流选址、货位优化
8.微电网优化、无功优化、配电网重构、储能配置
9.元胞自动机交通流 人群疏散 病毒扩散 晶体生长
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /boutique/detail/tanhiaeiie
-
photoshop保存的图片太大微信发不了怎么办
PHP中文网 06-15 -
word里面弄一个表格后上面的标题会跑到下面怎么办
PHP中文网 06-20 -
photoshop扩展功能面板显示灰色怎么办
PHP中文网 06-14 -
《学习通》视频自动暂停处理方法
HelloWorld317 07-05 -
Android 11 保存文件到外部存储,并分享文件
Luke 10-12 -
TikTok加速器哪个好免费的TK加速器推荐
TK小达人 10-01 -
微信公众号没有声音提示怎么办
PHP中文网 03-31 -
excel下划线不显示怎么办
PHP中文网 06-23 -
excel打印预览压线压字怎么办
PHP中文网 06-22 -
微信运动停用后别人还能看到步数吗
PHP中文网 07-22