天天看點

【數字信号調制】基于matlab實作AM調制系統附GUI界面

1 内容介紹

在設計通信系統數字信号仿真平台的基礎上,應用MATLAB軟體對二進制數字調制信号進行仿真,具體包括對二進制數字調制信号中的二進制幅度鍵控信号、二進制頻移鍵控信号和二進制相移鍵控信号的仿真,并應用GUI的相應控件搭建通信系統數字信号的仿真平台。

2 部分代碼

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%                                                                    %

%                      AM modulation with GUI                        %

%                                                                    %

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function varargout = am_mod(varargin)

% Edit the above text to modify the response to help am_mod

% Last Modified by GUIDE v2.5 02-Jun-2022 16:43:51

% Begin initialization code - DO NOT EDIT

gui_Singleton = 1;

gui_State = struct('gui_Name',       mfilename, ...

                   'gui_Singleton',  gui_Singleton, ...

                   'gui_OpeningFcn', @am_mod_OpeningFcn, ...

                   'gui_OutputFcn',  @am_mod_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

% --- Executes just before am_mod is made visible.

function am_mod_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 am_mod (see VARARGIN)

set(handles.carrier,'Value',0.5);

set(handles.mod,'Value',0.5);

handles.ejex=0:1/1000:.5;

axes(handles.axes1)

y_m=.5*cos(2*pi*25*handles.ejex)+1;

plot(handles.ejex,y_m,'--','Color',[1 0 1]);hold on;

y_c=cos(2*pi*100*handles.ejex);

y_am=y_m.*y_c;

plot(handles.ejex,y_am)

hold off;

title('AM信号');

ylabel('振幅');

xlabel('時間(s)');

axes(handles.axes2)

plotspec(y_am,1/1000);

title('光譜');

%zoom on

% Choose default command line output for am_mod

handles.output = hObject;

% Update handles structure

guidata(hObject, handles);

% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.

function varargout = am_mod_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 slider movement.

function mod_Callback(hObject, eventdata, handles)

% hObject    handle to mod (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,'Value') returns position of slider

%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider

f_m=50*get(hObject,'Value');

f_c=200*get(handles.carrier,'Value');

set(handles.fc,'String',f_c);

set(handles.fm,'String',f_m);

axes(handles.axes1)

y_m=.5*cos(2*pi*f_m*handles.ejex)+1;

plot(handles.ejex,y_m,'--','Color',[1 0 0]);hold on;

y_c=cos(2*pi*f_c*handles.ejex);

y_am=y_m.*y_c;

% --- Executes on button press in zoom.

function zoom_Callback(hObject, eventdata, handles)

% hObject    handle to zoom (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 zoom

a=get(hObject,'Value');

if a==1

    zoom on;

    set(handles.zoom,'String','放大');

else

    zoom off;

    set(handles.zoom,'String','縮小');

end

 c  

% --- Executes on button press in close.

function close_Callback(hObject, eventdata, handles)

% hObject    handle to close (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 close

clc

close all

3 運作結果

【數字信号調制】基于matlab實作AM調制系統附GUI界面
【數字信号調制】基于matlab實作AM調制系統附GUI界面

4 參考文獻

部落客簡介:擅長​​智能優化算法​​、​​神經網絡預測​​、​​信号處理​​、​​元胞自動機​​、​​圖像處理​​、​​路徑規劃​​、​​無人機​​、​​雷達通信​​、​​無線傳感器​​等多種領域的Matlab仿真,相關matlab代碼問題可私信交流。

部分理論引用網絡文獻,若有侵權聯系部落客删除。