How can I extract the width of the following graph.

I have made a farfield profile from the Phased Array and want to find how the width of the beam changes with the reduction of the number of emitting elements. I extract this data to matlab. And find the HWFM but when doing so I only get the same width for all the elements. The width doesn't change with the number of elements. But in my simulations the width is changing. This is the code that use for extracting the width. I only need the width of the main lobe of this plot. Which is the part of the highest intensity.
clear;
load('matlab_analysis_farfield.mat');
E_intensity = abs(E2);
% Find the half max value.
halfMax = (min(E2) + max(E2)) / 2;
% Find where the data first drops below half the max.
index1 = find(E2 >= halfMax, 1, 'first');
% Find where the data last rises above half the max.
index2 = find(E2 >= halfMax, 1, 'last');
fwhm = index2-index1 + 1; % FWHM in indexes.
% OR, if you have an x vector
fwhmx = E2(index2) - E2(index1);
%I have found this code in the forum.
%to do check this if this works.
peakHeight = max(E2);
x1 = min(E2);
x2 = find(E2 <= peakHeight, 1, 'last');
theWidth = x2-x1;

8 Kommentare

hello
for me the width is defined by the -3 dB points (reference = centerline) as explained below :
Thank you for your response, currently I am designing optical phased array and the emitters are waveguides. I was only interested how the shape of the beam changes relative to the number of waveguides. The next step is to calculate at 3db.
hello
ok , so the first step is to plot E for different number of waveguides and this is made before the plot code that you show
so , if I understand right, the issue is in the code that generate the E data ?
Exactly! I simulate in FDTD and extract the data to matlab for further manipulation. The farfield plot that you can see is from the 3D fdtd if I plot it in matlab I will see this. This is the E component. So what I did I made 2D ftdt simulation and was able to extract the beam width by image processing toolbox. This is also a solution, but what I wanted is to find the widht of the above mentioned plot. .
hello
this piece of code will give you the angle . Demo based on a half sinus wave.
you can easily apply it to your case
x= linspace(0,pi,100);
y = sin(x);
minus3dBpoint = 1/sqrt(2); % -3 dB
z = abs(y-minus3dBpoint);
[p,loc] = findpeaks(-z);
plot(x,y,'b',x(loc),y(loc),'+r');
% angle = half of difference between the 2 elements of x(loc)
angle = diff(x(loc))/2
of course , my example (sinus) has a peak amplitude of 1 , which is not your case
you'll figure out how to adapt the code....
Thank you very much. I will adapt it.
you're welcome
may I ask you to accept my answer ?
I put it in the answer again so you can accept it
tx

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Mathieu NOE
Mathieu NOE am 24 Nov. 2020
hello
this piece of code will give you the angle . Demo based on a half sinus wave.
you can easily apply it to your case
x= linspace(0,pi,100);
y = sin(x);
minus3dBpoint = 1/sqrt(2); % -3 dB
z = abs(y-minus3dBpoint);
[p,loc] = findpeaks(-z);
plot(x,y,'b',x(loc),y(loc),'+r');
% angle = half of difference between the 2 elements of x(loc)
angle = diff(x(loc))/2
of course , my example (sinus) has a peak amplitude of 1 , which is not your case
you'll figure out how to adapt the code....

Weitere Antworten (0)

Kategorien

Mehr zu Data Type Identification finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by