【信号分析】基于matlab的信号分析附GUI界面

简介: 【信号分析】基于matlab的信号分析附GUI界面

✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。

🍎个人主页:Matlab科研工作室

🍊个人信条:格物致知。

更多Matlab仿真内容点击👇

智能优化算法       神经网络预测       雷达通信      无线传感器        电力系统

信号处理              图像处理               路径规划       元胞自动机        无人机

⛄ 内容介绍

本文主要介绍基于MATLAB GUI的信号分析仪的设计,使用MATLAB图形用户界面中的各种控件来实现对参数的设定并最终显示信号波形曲线图.此分析仪能够输出的曲线图有时域曲线,复域曲线,频域曲线以及时域曲线与频域曲线的对比,使得能够准确的观察时域曲线与频域曲线的同步变化情况.

⛄ 部分代码

function varargout = juli(varargin)

% JULI M-file for juli.fig

%      JULI, by itself, creates a new JULI or raises the existing

%      singleton*.

%

%      H = JULI returns the handle to a new JULI or the handle to

%      the existing singleton*.

%

%      JULI('CALLBACK',hObject,eventData,handles,...) calls the local

%      function named CALLBACK in JULI.M with the given input arguments.

%

%      JULI('Property','Value',...) creates a new JULI or raises the

%      existing singleton*.  Starting from the left, property value pairs are

%      applied to the GUI before juli_OpeningFcn gets called.  An

%      unrecognized property name or invalid value makes property application

%      stop.  All inputs are passed to juli_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 juli


% Last Modified by GUIDE v2.5 28-May-2008 19:12:14


% Begin initialization code - DO NOT EDIT

gui_Singleton = 1;

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

                  'gui_Singleton',  gui_Singleton, ...

                  'gui_OpeningFcn', @juli_OpeningFcn, ...

                  'gui_OutputFcn',  @juli_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 juli is made visible.

function juli_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 juli (see VARARGIN)


% Choose default command line output for juli

handles.output = hObject;


% Update handles structure

guidata(hObject, handles);


% UIWAIT makes juli wait for user response (see UIRESUME)

% uiwait(handles.figure1);



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

function varargout = juli_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 selection change in listbox1.

function listbox1_Callback(hObject, eventdata, handles)

val=get(handles.listbox1 ,'Value');

switch val

case 1

 t=-1:0.01:10;

 y1=sin(2*pi*t);

 axes(handles.axes1);

plot(t,y);


case 2

    t=-1:0.01:10;

 y1=cos(2*pi*t);

 axes(handles.axes1);

plot(t,y);


case 3

   t=-1:0.01:10;

   y1=square(2*pi*t);

   axes(handles.axes1);

plot(t,y);

case 4

       t=-1:0.01:10;

 axes(handles.axes1);


y1=sawtooth(2*pi*t);

plot(t,y);

case 5

   t=-3:0.001:5;

   axes(handles.axes1);


y1=tripuls(t,4,0.5);

plot(t,y);


 

end

% hObject    handle to listbox1 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)


% Hints: contents = get(hObject,'String') returns listbox1 contents as cell array

%        contents{get(hObject,'Value')} returns selected item from listbox1



% --- Executes during object creation, after setting all properties.

function listbox1_CreateFcn(hObject, eventdata, handles)

% hObject    handle to listbox1 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    empty - handles not created until after all CreateFcns called


% Hint: listbox 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)

 t=-3:0.1:10;

hfstext=findobj('tag','edit1');

h=get(hfstext,'string');

w=str2num(h);

axes(handles.axes2);


y=sin(w*t);

plot(t,y);


% 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)



% --- Executes on button press in pushbutton2.

function pushbutton2_Callback(hObject, eventdata, handles)

val=get(handles.popupmenu1 ,'Value');

switch val

case 1

 t=0:0.1:10;

 hfstext=findobj('tag','edit1');

h=get(hfstext,'string');

w=str2num(h);

y=sin(w*t);


 

 y1=sin(2*pi*t);

 y2=y.*y1

 axes(handles.axes3);

plot(t,y2);


case 2

    t=0:0.01:10;

 y1=cos(2*pi*t);

  hfstext=findobj('tag','edit1');

h=get(hfstext,'string');

w=str2num(h);

y=sin(w*t);


    y2=y.*y1

 axes(handles.axes3);

plot(t,y);


case 3

   t=0:0.01:10;

   y1=square(2*pi*t);

  hfstext=findobj('tag','edit1');

h=get(hfstext,'string');

w=str2num(h);

y=sin(w*t);


      y2=y.*y1

   axes(handles.axes3);

plot(t,y);

case 4

       t=0:0.01:10;

 


y1=sawtooth(2*pi*t);

hfstext=findobj('tag','edit1');

h=get(hfstext,'string');

w=str2num(h);

y=sin(w*t);


 y2=y.*y1

axes(handles.axes3);

plot(t,y);

case 5

   t=-3:0.001:5;

 

hfstext=findobj('tag','edit1');

h=get(hfstext,'string');

w=str2num(h);

y=sin(w*t);



y1=tripuls(t,4,0.5);

 y2=y.*y1

 axes(handles.axes3);

 

plot(t,y);

xlabel('时间(t)');


title('正弦信号');


 

end

% 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)



% --- Executes on selection change in popupmenu1.

function popupmenu1_Callback(hObject, eventdata, handles)

val=get(handles.popupmenu1 ,'Value');

switch val

case 1

 t=0:0.01:10;

 y=sin(2*pi*t);

 axes(handles.axes1);

plot(t,y);

xlabel('时间(t)');


title('正弦信号');


case 2

    t=0:0.01:10;

 y=cos(2*pi*t);

 axes(handles.axes1);

plot(t,y);

xlabel('时间(t)');


title('余弦信号');


case 3

   t=0:0.01:10;

   y=square(2*pi*t);

   axes(handles.axes1);

plot(t,y);

xlabel('时间(t)');


title('周期方波信号');

case 4

       t=0:0.01:10;

 axes(handles.axes1);


y=sawtooth(2*pi*t);

plot(t,y);

xlabel('时间(t)');


title('周期锯齿波信号');

case 5

   t=-3:0.001:5;

   axes(handles.axes1);


y=tripuls(t,4,0.5);

plot(t,y);

xlabel('时间(t)');


title('三角波信号');


 

end

% hObject    handle to popupmenu1 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)


% Hints: contents = get(hObject,'String') returns popupmenu1 contents as cell array

%        contents{get(hObject,'Value')} returns selected item from popupmenu1



% --- Executes during object creation, after setting all properties.

function popupmenu1_CreateFcn(hObject, eventdata, handles)

% hObject    handle to popupmenu1 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    empty - handles not created until after all CreateFcns called


% Hint: popupmenu 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 slider movement.

function slider1_Callback(hObject, eventdata, handles)

fs=get(hObject,'value');

hfstext=findobj('tag','edit1');

set(hfstext,'string',num2str(fs));

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



% --- Executes during object creation, after setting all properties.

function slider1_CreateFcn(hObject, eventdata, handles)

% hObject    handle to slider1 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    empty - handles not created until after all CreateFcns called


% Hint: slider controls usually have a light gray background.

if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

   set(hObject,'BackgroundColor',[.9 .9 .9]);

end




function edit1_Callback(hObject, eventdata, handles)

fs=get(hObject,'value');

hfs=findobj('tag','slider1');

set(hfs,'string',num2str(fs));

% 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



% --- Executes on button press in pushbutton3.

function pushbutton3_Callback(hObject, eventdata, handles)

close;

main

% 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)



% --- Executes on button press in checkbox1.

function checkbox1_Callback(hObject, eventdata, handles)

r=get(hObject,'value');

if r==1

   

   grid on

else

   grid off

end

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



% --- Executes on button press in checkbox2.

function checkbox2_Callback(hObject, eventdata, handles)

r=get(hObject,'value');

if r==1

   

zoom on

else

  zoom off

end

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


⛄ 运行结果

⛄ 参考文献

[1] 陈瑞峰, 左曙光, 郭伟. 基于MATLAB GUI的信号分析系统[J]. 佳木斯大学学报:自然科学版, 2009, 27(5):4.

[2] 赵秋英, 吴玲, 徐秀丽. 基于MATLAB GUI的信号分析仪设计[J]. 中国科技博览, 2015(004):000.

⛳️ 代码获取关注我

❤️部分理论引用网络文献,若有侵权联系博主删除
❤️ 关注我领取海量matlab电子书和数学建模资料


相关文章
|
8月前
|
数据采集 安全 新能源
【节点边际电价】机组运行约束对机组节点边际电价的影响分析(Matlab代码实现)
【节点边际电价】机组运行约束对机组节点边际电价的影响分析(Matlab代码实现)
392 2
【节点边际电价】机组运行约束对机组节点边际电价的影响分析(Matlab代码实现)
|
7月前
|
新能源 Java Go
【EI复现】参与调峰的储能系统配置方案及经济性分析(Matlab代码实现)
【EI复现】参与调峰的储能系统配置方案及经济性分析(Matlab代码实现)
250 0
|
8月前
|
安全 调度
【火电机组、风能、储能】高比例风电电力系统储能运行及配置分析(Matlab代码实现)
【火电机组、风能、储能】高比例风电电力系统储能运行及配置分析(Matlab代码实现)
112 0
|
8月前
|
机器学习/深度学习 数据采集 算法
【信号识别】识别半监督粗糙模糊拉普拉斯特征图(Matlab代码实现)
【信号识别】识别半监督粗糙模糊拉普拉斯特征图(Matlab代码实现)
129 0
|
8月前
|
数据采集 算法 前端开发
MATLAB|基于3D FDTD的微带线馈矩形天线分析[用于模拟超宽带脉冲通过线馈矩形天线的传播,以计算微带结构的回波损耗参数]
MATLAB|基于3D FDTD的微带线馈矩形天线分析[用于模拟超宽带脉冲通过线馈矩形天线的传播,以计算微带结构的回波损耗参数]
327 2
|
8月前
|
安全 算法 自动驾驶
使用SSTL规范控制信号化交叉口研究(Matlab代码实现)
使用SSTL规范控制信号化交叉口研究(Matlab代码实现)
119 6
|
7月前
|
开发框架 算法 .NET
基于ADMM无穷范数检测算法的MIMO通信系统信号检测MATLAB仿真,对比ML,MMSE,ZF以及LAMA
简介:本文介绍基于ADMM的MIMO信号检测算法,结合无穷范数优化与交替方向乘子法,降低计算复杂度并提升检测性能。涵盖MATLAB 2024b实现效果图、核心代码及详细注释,并对比ML、MMSE、ZF、OCD_MMSE与LAMA等算法。重点分析LAMA基于消息传递的低复杂度优势,适用于大规模MIMO系统,为通信系统检测提供理论支持与实践方案。(238字)
|
9月前
|
机器学习/深度学习 数据采集 搜索推荐
【图像分类】基于主成分分析和核支持向量机的脑磁共振图像分类器(Matlab代码实现)
【图像分类】基于主成分分析和核支持向量机的脑磁共振图像分类器(Matlab代码实现)
158 1
|
8月前
|
机器学习/深度学习 算法 决策智能
MATLAB中双馈发电机与无刷双馈发电机低电压穿越的异同分析
MATLAB中双馈发电机与无刷双馈发电机低电压穿越的异同分析
|
8月前
|
机器学习/深度学习 算法 语音技术
【语音分离】通过分析信号的FFT,根据音频使用合适的滤波器进行语音信号分离(Matlab代码实现)
【语音分离】通过分析信号的FFT,根据音频使用合适的滤波器进行语音信号分离(Matlab代码实现)
263 4

热门文章

最新文章