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

Posted 紫极神光

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了故障诊断分析基于matlab GUI小波包能量可视化设计含Matlab源码 1788期相关的知识,希望对你有一定的参考价值。

一、案例简介

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(varargin1)
    gui_State.gui_Callback = str2func(varargin1);
end

if nargout
    [varargout1: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
varargout1 = 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
%        contentsget(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.

以上是关于故障诊断分析基于matlab GUI小波包能量可视化设计含Matlab源码 1788期的主要内容,如果未能解决你的问题,请参考以下文章

故障诊断分析基于matlab小波变换外圈轴承故障诊断含Matlab源码 1678期

基于小波包Tsallis熵和RVM的模拟电路故障诊断

小波与小波包小波包分解与信号重构小波包能量特征提取 暨 小波包分解后实现按频率大小分布重新排列(Matlab 程序详解)

故障分析基于matlab GUI鼠笼式异步电机转子断条故障诊断含Matlab源码 1089期

小波包及其应用

故障诊断分析基于matlab滚动轴承故障诊断系统含Matlab源码 1679期