【故障诊断分析】基于matlab GUI小波包能量可视化设计【含Matlab源码 1788期】

举报
海神之光 发表于 2022/05/28 23:13:56 2022/05/28
【摘要】 一、案例简介 1 借用小波包分解和小波能量熵函数; 2 西储大学轴承故障数据; 3 提取小波能量方便快捷; 二、部分源代码 function varargout = wavlet_package_e...

一、案例简介

1 借用小波包分解和小波能量熵函数;
2 西储大学轴承故障数据;
3 提取小波能量方便快捷;

二、部分源代码

function varargout = wavlet_package_energy_GUI(varargin)
% WAVLET_PACKAGE_ENERGY_GUI MATLAB code for wavlet_package_energy_GUI.fig
%      WAVLET_PACKAGE_ENERGY_GUI, by itself, creates a new WAVLET_PACKAGE_ENERGY_GUI or raises the existing
%      singleton*.
%
%      H = WAVLET_PACKAGE_ENERGY_GUI returns the handle to a new WAVLET_PACKAGE_ENERGY_GUI or the handle to
%      the existing singleton*.
%
%      WAVLET_PACKAGE_ENERGY_GUI('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in WAVLET_PACKAGE_ENERGY_GUI.M with the given input arguments.
%
%      WAVLET_PACKAGE_ENERGY_GUI('Property','Value',...) creates a new WAVLET_PACKAGE_ENERGY_GUI or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before wavlet_package_energy_GUI_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to wavlet_package_energy_GUI_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 wavlet_package_energy_GUI

% Last Modified by GUIDE v2.5 10-Mar-2022 12:18:06

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @wavlet_package_energy_GUI_OpeningFcn, ...
                   'gui_OutputFcn',  @wavlet_package_energy_GUI_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 wavlet_package_energy_GUI is made visible.
function wavlet_package_energy_GUI_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 wavlet_package_energy_GUI (see VARARGIN)

% Choose default command line output for wavlet_package_energy_GUI
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes wavlet_package_energy_GUI wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = wavlet_package_energy_GUI_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)
% 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 = cellstr(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 selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
% 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)
position1=get(handles.popupmenu1,'value')
if position1==1
load('99.mat');
x=X099_DE_time;
title_1='0号hp=2';
end
if position1==2
position_sub=2;
load('3003.mat');
x=X058_DE_time;
title_1='4号故障hp=2';
end
if position1==3
position_sub=3;
load('248.mat');
x=X248_DE_time;
title_1='7号hp=2: 负载3点位置:';
end
if position1==4
position_sub=4;
load('187.mat');
x=X187_DE_time;
title_1='10号hp=2:';
end
position_sub=2;
figure(1)
plot(x)
grid on
figure(2)
wpt=wpdec(x,4,'db1');
plot(wpt);
for i=0:15
    figure(3);
    rfs=wprcoef(wpt,[4,i]);
    subplot(4,4,i+1);
    plot(rfs);
    grid on;
    title(['[4',num2str(i),']']);
    axis([0 12000 min(rfs) max(rfs)]);
end
for i=0:3
    figure(4);
    rfs=wprcoef(wpt,[4,i]);
    subplot(4,1,i+1);
    plot(rfs);
    grid on;
    title(['[4',num2str(i),']']);
    axis([0 12000 min(rfs) max(rfs)]);
end
for i=1:4
    wpt=wpdec(x,i,'db1');
    e=wenergy(wpt);
    E=zeros(1,length(e));
    for j=1:2^i
        E(j)=sum(abs(wprcoef(wpt,[i,j-1])).^2);
    end
    figure(5)
    subplot(4,1,i);
    bar(e);
    axis([0 length(e) 0 130]);
    title(['第',num2str(i),'层']);
    for j=1:length(e)
        text(j-0.2,e(j)+20,num2str(e(j),'%2.2f'));
    end
   if i==4
       figure(100)
    subplot(4,1,position1);
    bar(e);
    axis([0 length(e) 0 130]);
    title([title_1,'第',num2str(i),'层能量']);
    for j=1:length(e)
        text(j-0.2,e(j)+20,num2str(e(j),'%2.2f'));
    end
   end
end

  
 

三、运行结果

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

四、matlab版本及参考文献

1 matlab版本
2014a

2 参考文献
[1] 沈再阳.精通MATLAB信号处理[M].清华大学出版社,2015.
[2]高宝建,彭进业,王琳,潘建寿.信号与系统——使用MATLAB分析与实现[M].清华大学出版社,2020.
[3]王文光,魏少明,任欣.信号处理与系统分析的MATLAB实现[M].电子工业出版社,2018.

文章来源: qq912100926.blog.csdn.net,作者:海神之光,版权归原作者所有,如需转载,请联系作者。

原文链接:qq912100926.blog.csdn.net/article/details/123534455

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。