MATLAB Answers

How to find the 80 and 20 percent positions on a gaussian profile - Penumbral width

16 views (last 30 days)
Luis Munoz
Luis Munoz on 20 Jan 2021
Commented: Luis Munoz on 20 Jan 2021
I have code to figure out the full width at half maximum for a gaussian profile. I need to find the distance between the 80 and 20 percent positions on both sides of a the gaussian profile.
I need the code to interpolate about to correctly acquire 80 and 20 percent positions on both sides of the gaussian. Any thoughts would be appreciated. I've added a spreadsheet with sample data.
Dmax = max(doseProfile(:,2));
Dmin = min(doseProfile(:,2));
x = doseProfile(:,1);
D = doseProfile(:,2);
xi = doseProfile(1,1):0.1:doseProfile(end,1);
Di = interp1(x,D,xi);
xiDoseAbove50 = xi (find(Di>(Dmax-Dmin)/2));
y = xiDoseAbove50(end)-xiDoseAbove50(1);


Sign in to comment.

Accepted Answer

Mathieu NOE
Mathieu NOE on 20 Jan 2021
attached your code , beefed up with the attached function (computes the coordinates of crossing point of your data with given y threshold)
x = doseProfile(:,1);
D = doseProfile(:,2);
% positive x , D = 20 and 80 positions
ind = find(x>=0);
xpos = x(ind);
Dpos = D(ind);
% [ind_pos,t0_pos,s0_pos,ind_neg,t0_neg,s0_neg] = crossing_V7(S,t,level,imeth)
[~,~,~,~,xpos20,~] = crossing_V7(Dpos,xpos,20,'linear');
[~,~,~,~,xpos80,~] = crossing_V7(Dpos,xpos,80,'linear');
% x distance
XDpos = xpos20-xpos80
% negative x , D = 20 and 80 positions
ind = find(x<=0);
xneg = x(ind);
Dneg = D(ind);
[~,xneg20,~,~,~,~] = crossing_V7(Dneg,xneg,20,'linear');
[~,xneg80,~,~,~,~] = crossing_V7(Dneg,xneg,80,'linear');
% x distance
XDneg = xneg80-xneg20

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by