【故障诊断分析】基于matlab GUI小波包能量可视化设计【含Matlab源码 1788期】
【摘要】
一、案例简介
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
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
- 155
- 156
- 157
- 158
- 159
- 160
- 161
- 162
- 163
- 164
- 165
- 166
- 167
- 168
- 169
- 170
- 171
- 172
- 173
- 174
- 175
- 176
- 177
- 178
- 179
- 180
三、运行结果
四、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)