【数字信号去噪】基于matlab同心兰姆波模式分解【含Matlab源码 679期】
【摘要】
一、获取代码方式
获取代码方式1: 完整代码已上传我的资源:【数字信号去噪】基于matlab同心兰姆波模式分解【含Matlab源码 679期】
获取代码方式2: 通过订阅紫极神光博客付费专栏,凭支付凭...
一、获取代码方式
获取代码方式1:
完整代码已上传我的资源:【数字信号去噪】基于matlab同心兰姆波模式分解【含Matlab源码 679期】
获取代码方式2:
通过订阅紫极神光博客付费专栏,凭支付凭证,私信博主,可获得此代码。
备注:
订阅紫极神光博客付费专栏,可免费获得1份代码(有效期为订阅日起,三天内有效);
二、部分源代码
%% Parameters
clear; clc; close all; format shortg; warning off;
%% Setup folders
folderDataExp = fullfile(cd(cd('..')),'data','exp');
%% Load raw signals
% CH0 : Dual PZT A
% CH1 : Dual PZT B
% CH2 : Dual PZT D
% CH3 : Dual PZT C
%
% The channel order is that only dual PZTs A, B, and D are used
% for the proposed technique, which are installed on a single side. Dual
% PZT C (CH3) is installed to validate decomposition results.
% AB_F{i,j} indicates excitation at dual PZT A and sensing at dual PZT B.
% i and j denote the different part(s) of the dual PZT activated for
% excitation and sensing. 1, 2, and 3 represent the entire, ring and
% circular parts of the dual PZT, respectively. For example, AB_F13 means
% the response signals measured at the circular part of the dual PZT B when
% both ring and circular part of dual PZT A is actuated.
% Notations are defined in similar fashion in case of FEM simulation.
% The raw signals are stored in AB_F, AD_F, CB_F and CD_F.
AB_F = cell(3,3);AD_F = cell(3,3);
CB_F = cell(3,3);CD_F = cell(3,3);
for ii=1:3
for jj=1:3
AB = ['180k_CH0CH1_F' int2str(ii) int2str(jj)];
AD = ['180k_CH0CH2_F' int2str(ii) int2str(jj)];
CB = ['180k_CH3CH1_F' int2str(ii) int2str(jj)];
CD = ['180k_CH3CH2_F' int2str(ii) int2str(jj)];
load(fullfile(folderDataExp,AB));
load(fullfile(folderDataExp,AD));
load(fullfile(folderDataExp,CB));
load(fullfile(folderDataExp,CD));
AB_F{ii,jj} = eval(['transpose(X' AB ');']);
AD_F{ii,jj} = eval(['transpose(X' AD ');']);
CB_F{ii,jj} = eval(['transpose(X' CB ');']);
CD_F{ii,jj} = eval(['transpose(X' CD ');']);
end
end; clearvars -except AB_F AD_F CB_F CD_F;
%% Decomposition of S0 and A0 mode signals using collocate dual PZTs
% These are considered as reference (ground-truth).
% In Section 3.2, S0 and A0 mode signals are obatined by adding and
% subtracting respones from dual PZTs B and C, respectively. (Please refer
% the following paper : S.B. Kim, H. Sohn, Instantaneous reference-free
% crack detection based on polarization characteristics of piezoelectric
% materials, Smart Mater. Struct. 16 (2007) 2375?387.
% S0_D_F_Col: S0 mode extracted from a signal measured between path AD
% using collocated PZTs
% A0_D_F_Col: A0 mode extracted from a signal measured between path AD
% using collocated PZTs
S0_D_F_Col = cellfun(@(x,y) plus(x,y)/2, AD_F, CD_F,'UniformOutput',0);
A0_D_F_Col = cellfun(@(x,y) minus(x,y)/2, AD_F, CD_F,'UniformOutput',0);
% S0_B_F_Col: S0 mode extracted from a signal measured between path AB
% using collocated PZTs
% A0_B_F_Col: A0 mode extracted from a signal measured between path AB
% using collocated PZTs
S0_B_F_Col = cellfun(@(x,y) plus(x,y)/2, AB_F, CB_F,'UniformOutput',0);
A0_B_F_Col = cellfun(@(x,y) minus(x,y)/2, AB_F, CB_F,'UniformOutput',0);
%% Decomposition of S0 and A0 mode at path AD using the proposed method
S0_range = 5000:5600;
A0_range = 5600:5900;
[~, S_LOC] = cellfun(@(x) max(x(S0_range)),AD_F);
[~, A_LOC] = cellfun(@(x) max(x(A0_range)),AD_F);
% scaling factor obtained from experiment signals
scaleFact_S_AD = cellfun(@(x,y) x(y),AD_F,num2cell(S_LOC+S0_range(1)-1));
scaleFact_A_AD = cellfun(@(x,y) x(y),AD_F,num2cell(A_LOC+A0_range(1)-1));
scalingMatrix_AD_MD = [reshape(scaleFact_S_AD,9,1)/scaleFact_S_AD(1) ...
reshape(scaleFact_A_AD,9,1)/scaleFact_A_AD(1)];
% S0 and A0 modes can be reconstred by mutiplying scaling factors and
% common factors Ms = S11*C(1) for S0 mode and Ma = A11*C(2) for A0 mode.
% We know V matrix (signal matrix) and scaling matrix (scaled with S11 and
% A11) so we can compute common factor Ms and Ma. Please see eq.(7).
inv_S_AD = pinv(scalingMatrix_AD_MD);
Ms_AD = inv_S_AD(1,:) * cell2mat(reshape(AD_F,9,1));
Ma_AD = inv_S_AD(2,:) * cell2mat(reshape(AD_F,9,1));
% S0 and A0 mode extracted using the proposed mode decomposition method
S0_D_F_MD = cellfun(@(x,y) x*y, repmat({Ms_AD},3,3), ...
num2cell(reshape(scalingMatrix_AD_MD(:,1),3,3)), ...
'UniformOutput',0);
A0_D_F_MD = cellfun(@(x,y) x*y, repmat({Ma_AD},3,3), ...
num2cell(reshape(scalingMatrix_AD_MD(:,2),3,3)), ...
'UniformOutput',0);
clearvars S_LOC A_LOC scaleFact_S_AD scaleFact_A_AD S0_range A0_range
clearvars inv_S_AD Ms_AD Ma_AD
%% Decomposition of S0 and A0 mode at path AD using the proposed method
inv_S_AB = pinv(scalingMatrix_AD_MD);
Ms_AB = inv_S_AB(1,:) * cell2mat(reshape(AB_F,9,1));
Ma_AB = inv_S_AB(2,:) * cell2mat(reshape(AB_F,9,1));
S0_B_F_MD = cellfun(@(x,y) x*y, repmat({Ms_AB},3,3), ...
num2cell(reshape(scalingMatrix_AD_MD(:,1),3,3)), ...
'UniformOutput',0);
A0_B_F_MD = cellfun(@(x,y) x*y, repmat({Ma_AB},3,3), ...
num2cell(reshape(scalingMatrix_AD_MD(:,2),3,3)), ...
'UniformOutput',0);
clearvars S_LOC A_LOC scaleFact_S_AB scaleFact_A_AB S0_range A0_range
clearvars inv_S_AB Ms_AB Ma_AB
%% Output Plot
% Ouput folder
folderOut = fullfile(cd(cd('..')),'output');
%% Comparison of the normalized scaling factors of the S0 and A0 modes
% In theory, the normalized scaling factors should be identical among
% these two paths as long as the sizes of the used dual PZTs are identical.
% Please see Fig. 11.
% Scaling factor computation at AD using collocate PZTS
S0_range = 5000:5600;
A0_range = 5600:5900;
[~, S_LOC] = cellfun(@(x) max(x(S0_range)),S0_D_F_Col);
[~, A_LOC] = cellfun(@(x) max(x(A0_range)),A0_D_F_Col);
scaleFact_S_D = ...
cellfun(@(x,y) x(y),S0_D_F_Col,num2cell(S_LOC+S0_range(1)-1));
scaleFact_A_D = ...
cellfun(@(x,y) x(y),A0_D_F_Col,num2cell(A_LOC+A0_range(1)-1));
scalingMatrix_AD_Col = [reshape(scaleFact_S_D',9,1)/scaleFact_S_D(1) ...
reshape(scaleFact_A_D',9,1)/scaleFact_A_D(1)];
clearvars S_LOC A_LOC scaleFact_S_D scaleFact_A_D S0_range A0_range
% Scaling factor computation at AB using collocate PZTS
S0_range = 5000:5400;
A0_range = 5000:5500;
[~, S_LOC] = cellfun(@(x) max(x(S0_range)),S0_B_F_Col);
[~, A_LOC] = cellfun(@(x) max(x(A0_range)),A0_B_F_Col);
scaleFact_S_B = ...
cellfun(@(x,y) x(y),S0_B_F_Col,num2cell(S_LOC+S0_range(1)-1));
scaleFact_A_B = ...
cellfun(@(x,y) x(y),A0_B_F_Col,num2cell(A_LOC+A0_range(1)-1));
scalingMatrix_AB_Col = [reshape(scaleFact_S_B',9,1)/scaleFact_S_B(1) ...
reshape(scaleFact_A_B',9,1)/scaleFact_A_B(1)];
clearvars S_LOC A_LOC scaleFact_S_B scaleFact_A_B S0_range A0_range
y_S0(:,1) = scalingMatrix_AD_Col(:,1);
y_S0(:,2) = scalingMatrix_AB_Col(:,1);
y_A0(:,1) = scalingMatrix_AD_Col(:,2);
y_A0(:,2) = scalingMatrix_AB_Col(:,2);
figure(1) ; x = 1:9;
h = stem(x,y_S0,'fill','--','linewidth',2);
legend('AB path', 'AD path');legend('location','northEast', ...
'orientation', 'horizontal');legend('boxoff');
set(h(1),'MarkerFaceColor','red','Marker','s','markeredgecolor','none')
set(h(2),'MarkerFaceColor','blue','Marker','d','markeredgecolor','none')
set(gca, 'xTickLabel',{'S_1_1';'S_1_2';'S_1_3';'S_2_1'; ...
'S_2_2';'S_2_3';'S_3_1';'S_3_2';'S_3_3';})
xlim([0 10]);%ylim([-8 8]);
set(gca,'fontsize',12,'linewidth',2,'fontweight','bold','XTick' ,[1:9]);
set(gcf,'pos',[50 50 450 250]);
xlabel('\bf Normalized scaling factor');
ylabel('\bf Normalized amplitdue');
print(fullfile(folderOut,'EXP_ScalingS0'),'-djpeg','-r0')
figure(2) ; x = 1:9;
h = stem(x,y_A0,'fill','--','linewidth',2);
legend('AB path', 'AD path');legend('location','northEast', ...
'orientation', 'horizontal');legend('boxoff');
set(h(1),'MarkerFaceColor','red','Marker','s','markeredgecolor','none')
set(h(2),'MarkerFaceColor','blue','Marker','d','markeredgecolor','none')
set(gca, 'xTickLabel',{'A_1_1';'A_1_2';'A_1_3';'A_2_1'; ...
'A_2_2';'A_2_3';'A_3_1';'A_3_2';'A_3_3';})
xlim([0 10]);%ylim([-8 8]);
set(gca,'fontsize',12,'linewidth',2,'fontweight','bold','XTick' ,[1:9]);
set(gcf,'pos',[50 50 450 250]);
xlabel('\bf Normalized scaling factor');
ylabel('\bf Normalized amplitdue');
print(fullfile(folderOut,'EXP_ScalingA0'),'-djpeg','-r0')
%% Comparison between the S0 and A0 modes in the path AD
% decomposed by the proposed technique and the ones selectively generated
% by the collocated PTS. Please see Fig. 10.
% experiment parameter
startTime = 5000; % time point at a peak of toneburst input
fs = 5000000; % sampling frequency
endTime = 6500; % end time point to be plotted
x_path = 5000:6500;
x_time = (x_path-5000)./fs*1000 ; % for ms
- 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
- 181
- 182
- 183
- 184
- 185
- 186
- 187
- 188
- 189
- 190
- 191
- 192
- 193
- 194
- 195
- 196
- 197
- 198
- 199
- 200
- 201
- 202
- 203
- 204
- 205
- 206
- 207
- 208
三、运行结果
四、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/118118602
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)