Documente Academic
Documente Profesional
Documente Cultură
Question: The Question Originator asks how to start a MATLAB simulation for the research article
Guided Waves for monitoring of plate structures with linear cracks of variable length
authors B. Zima beazima@pg.gda.pl M. Rucka mrucka@pg.gda.pl , at Gdansk University Mechanical Engineering department.
Permission by the authors of the research paper has been granted to publish this text in the following web page:
https://jgb2012.wixsite.com/microwave-eng-matlab/matlab001-ellipses-to-detect-cracks
Background:
The location of a
damage slot of the
figure on the right
hand side is to be
found with a set of
sensors:
fig1
fig2
By damage point it's understood that it may go from slight scratch to through perforation.
The threshold on bounced back signals is assumed to be correct, and the possible scatter from the edges of the metal sheet
is also assumed to be solved.
The question why ellipses and not just circles are used should be addressed to the authors of the research paper.
_________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com https://jgb2012.wixsite.com/microwave-eng-matlab 1 / 12
MATLAB support QA001 29/05/2019 04:13:15.
Answer:
1. generates a
randomly located
damage slot with
random length and
tilt angle
2. then prompts for NS
sensor positions
with direct mouse
clicks of the sensors
3. calculates
histograms
equivalent to the
graphs closing point
3 of the research
article.
fig3
fig4
_________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com https://jgb2012.wixsite.com/microwave-eng-matlab 2 / 12
MATLAB support QA001 29/05/2019 04:13:15.
% ASSUMPTIONS
% homogeneous metal
% single scratch
% sensors do not overlap
% no sensor right on scratch, this is why manual input of sensor locations
% here d=dt*cg in Zima Rucka app note
% DEFINE PLATE
clear all;clc;close all
hf1=figure(1);grid on
ax1=hf1.CurrentAxes
ax1.DataAspectRatio=[1 1 1]
hold all
ax1.XTick=[x_range(1):10*x_res:x_range(end)]
ax1.YTick=[y_range(1):10*x_res:y_range(end)]
% SIMULATE DAMAGE
Nd=randi([3 25],1,1) % let the damage be a single straight scratch of random length range [5 25]
d_ang_res=2*pi/360 % let be the scratch attitude a random angle with resolution 1 degree
d_ang_range=[0:d_ang_res:2*pi-d_ang_res];
d_ang_target=d_ang_range(randi(numel([d_ang_range]),1,1))
% INPUT SENSORS
disp(['Place sensors with mouse: ' ' sensors.'])
p_s=ginput(NS)
plot(p_s(:,1),p_s(:,2),...
'LineStyle','none',...
'Marker','o',...
'MarkerSize',4,...
'MarkerEdgeColor',[.5 .5 .5],...
'MarkerFaceColor',[1,0.3921,0])
% round p_s
% pending
% just for plotting purpose, add safety frame on x axis max(x_s(i),x_d) and y axis max(y_s(i),y_d)
% pending
% MEASURE DISTANCES
L=combnk([1:1:NS],2) % L contains all possible combinations of paired sensors
x_c=[];y_c=[];phi=[]
for k=1:1:size(L,1)
pair_1=L(k,1); pair_2=L(k,2)
x_1=p_s(pair_1,1); y_1=p_s(pair_1,2)
x_2=p_s(pair_2,1); y_2=p_s(pair_2,2)
x_c=.5*(x_1+x_2); y_c=.5*(y_1+y_2)
_________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com https://jgb2012.wixsite.com/microwave-eng-matlab 3 / 12
MATLAB support QA001 29/05/2019 04:13:15.
d=[]
for q=1:1:size(S,2)
d=[d ((S(1,q)-x_1)^2+(S(2,q)-y_1)^2)^.5+((S(1,q)-x_2)^2+(S(2,q)-y_2)^2)^.5]
% d is like in bistatic radar: wave travels from p1 [x_1 y_1] to target (scratch) and then to p2 [x_2 y_2]
% this d Zima Rucka app note dt*cg
% d=[d pdist([S(1,q) x_1;S(2,q) y_1]')+pdist([S(1,q) x_2;S(2,q) y_2]')] % same as above line
plot([x_1 S(1,q) x_2],[y_1 S(2,q) y_2],'r-') % check
end
ell(k).d=d
a=d/2 % ell major set of axes for given ell generated for pair of sensors
ell(k).a=a
end
plot([x_d-Nd*x_res x_d+Nd*x_res],[y_d-Nd*x_res y_d+Nd*x_res],...
'LineWidth',1,...
'Color','k')
d_ang_res2=180/(2*pi)*d_ang_res
ang2=[0:d_ang_res2:360-d_ang_res2]
x=[];y=[];
for k=1:1:size(L,1)
x=[x ell(k).centroid(1)+(ell(k).a)'.*cosd(ang2).*cosd(180/(2*pi)*ell(k).phi)-(ell(k).b)'.*sind(ang2).*sind(180/(2*pi)*ell(k).phi)];
y=[y ell(k).centroid(2)+(ell(k).a)'.*cosd(ang2).*sind(180/(2*pi)*ell(k).phi)+(ell(k).b)'.*sind(ang2).*cosd(180/(2*pi)*ell(k).phi)];
end
figure(2);histogram(x);title('histogram(x)');grid on
figure(3);histogram(y);;title('histogram(y)');grid on
scr1
_________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com https://jgb2012.wixsite.com/microwave-eng-matlab 4 / 12
MATLAB support QA001 29/05/2019 04:13:15.
fig6
_________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com https://jgb2012.wixsite.com/microwave-eng-matlab 5 / 12
MATLAB support QA001 29/05/2019 04:13:15.
For the particular location of the damage in the above example, the damage has Y coordinates close to zero, the Y
histogram shows many peaks with values around 800 for the correct location of the damage Y coordinates, yet choosing the
tallest peaks above 1000 would cause erroneous decision regarding the Y coordinates of the damage slot. The same applies
to the X coordinates, the tallest histogram peaks do not correspond to the correct location of the damage slot.
Using multiple intersecting circles or ellipses to detect targets, not only pin-points the location of damage over the metal
sheet, but it also allows measuring span of for instance a straight scratch, which is the objective of the research article.
To measure the 'width' of the slot one could process the intersection of NS ellipses, one ellipse from each sensor, and do it
for each detected damage point. Then measure tip-to-tip distance.
ell ell =
1×10 struct array with fields:
centroid
c_dist
phi
d
a
b
scr2
The following part of the script 2nd cell, plots the actual ellipse points:
figure(4);
plot([x_range(1) x_range(end) x_range(end) x_range(1) x_range(1)],...
[y_range(1) y_range(1) y_range(end) y_range(end) y_range(1)],...
'LineWidth',2,...
'Color','b')
ax1.XTick=[x_range(1):10*x_res:x_range(end)]
ax1.YTick=[y_range(1):10*x_res:y_range(end)]
grid on
hold all
for k=1:1:NS
% figure(nk);
% title(['angle range sensor ' num2str(nk)])
plot(ell(k).centroid(1)+(ell(k).a)'.*cosd(ang2).*cosd(180/(2*pi)*ell(k).phi)-(ell(k).b)'.*sind(ang2).*sind(180/(2*pi)*ell(k).phi),...
ell(k).centroid(2)+(ell(k).a)'.*cosd(ang2).*sind(180/(2*pi)*ell(k).phi)+(ell(k).b)'.*sind(ang2).*cosd(180/(2*pi)*ell(k).phi),'+')
end
scr3
_________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com https://jgb2012.wixsite.com/microwave-eng-matlab 6 / 12
MATLAB support QA001 29/05/2019 04:13:15.
fig7
fig8
_________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com https://jgb2012.wixsite.com/microwave-eng-matlab 7 / 12
MATLAB support QA001 29/05/2019 04:13:15.
Alternatively one
may consider
choosing the shape
of the detected
damage as the
arrangement of
ellipse points that
show highest
alignment, but only
within the narrow
rectangle that must
contain NS*Nd
ellipse points, and at
the same time there
have to be inside
such rectangle at
least Nd points from
each sensor.
fig9
An alignment accuracy index could then be defined similar to Error Vector Measurement (EVM) that test instruments and
mobile phones carry out on wireless signals constellations to tell how noisy are received symbols.
Firstly zoom on the narrow are where all ellipses coincide, and then measure distance and angles between adjacent points,
to choose an estimate shape of the slot to detect.
fig10
_________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com https://jgb2012.wixsite.com/microwave-eng-matlab 8 / 12
MATLAB support QA001 29/05/2019 04:13:15.
There's high alignment around the yellow spot on the left hand side, but it's caused by only a few ellipses.
fig11
On figure 10 that yellow spot not all ellipses are present, so such narrow area should be discarded and measure alignment
only where all sensors produce ellipse points, for all Nd target points present.
Accuracy understood as tightness of the red rectangle on the correct damage area, improves when
_________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com https://jgb2012.wixsite.com/microwave-eng-matlab 9 / 12
MATLAB support QA001 29/05/2019 04:13:15.
I have tried increasing angle accuracy 10 fold, 0.1° angle resolution d_ang_res=2*pi/3600
fig12
There's even a false high alignment really close to the actual target, the red spot right on the blue boundary rectangle.
Yet the higher density of points in the narrow rectangle where all sensors produce ellipse points should allow for a more
accurate estimation of the target, provided a correct definition of alignment, EVM like, has been previously written.
It's important to keep sensors in tight formation, or an excessive misalignment of the ellipses causes that there is no such
narrow rectangle where all sensors produce Nd points each.
Then such narrow rectangle spans excessively reducing the accuracy required to pin point the damage slot.
_________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com https://jgb2012.wixsite.com/microwave-eng-matlab 10 / 12
MATLAB support QA001 29/05/2019 04:13:15.
It's in my opinion important to underline this point, because an excessive scattering of sensors may cause such ellipses
misalignment that pushes the target completely out of the narrow area where all ellipses overlap, and thus the all ellipses
intersecting method for each point belonging to the target would lead to locations where the target is not located at all.
To understand this, see the following example; the small red rectangle is the narrow area where all ellipses intersect, where
the overlap graph would show a estimation of the slot span, yet the target is actually located away of that area, the target
area not even containing all ellipses, yet being the area that should be produced as result:
fig12
fig13
_________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com https://jgb2012.wixsite.com/microwave-eng-matlab 11 / 12
MATLAB support QA001 29/05/2019 04:13:15.
To simulate with different sensor locations while holding same damage points, either edit S directly, or store the current
location of the target, for instance with save S.mat S , and then replace line
S=.1*floor(10*[x_d-Nd*x_res:x_res:x_d+Nd*x_res;y_d-Nd*x_res:x_res:y_d+Nd*x_res])
with
load('S.mat')
and run again the 1st cell to be prompted where to relocate sensors to.
Calculate each intersection point out of NS ellipses for each intersecting point, up to the Nd target points, this would allow
for the shape estimation of any arbitrary damage shape, not only straight slots. The function intersections.m would be
needed to obtain the actual intersecting points out of the available ellipse points.
_________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com https://jgb2012.wixsite.com/microwave-eng-matlab 12 / 12