# Creating a log probability plot for particle size distribution

14 views (last 30 days)

Show older comments

##### 0 Comments

### Accepted Answer

Star Strider
on 4 Oct 2022

##### 4 Comments

Star Strider
on 4 Oct 2022

Edited: Star Strider
on 4 Oct 2022

Working on this. I’m having problems getting the x-tick labels to plot correctly. The rest seems to be working. Back later.

EDIT — (4 Oct 2022 at 15:52)

This is as close as I can get, at least for the time being. There is obviously something I’m overlooking with respect to the x-axis scaling, since it’s not as I want it, and that affects how the tails are plotted. (The dashed reference line eludes me, and I am not comfortable with exploring the probplot code to see how it’s calculated.)

x1 = wblrnd(3,3,[500,1]); % Create Data

pd = fitdist(x1,'Weibull'); % Fit Distribution

yc = cdf(pd,x1); % Cumulative Distribution

[ycs,idxs] = sort(yc); % Sort For Plotting

x1s = x1(idxs);

pcv = linspace(1E-3, 100-1E-3, numel(x1)); % Vector Of Percentile Values

pc = prctile(x1,pcv); % Determine Data Percentiles

xaxt = [0.001 0.005 0.01 0.05 0.1 0.25 0.5 0.75 0.95 0.995]; % X-Axis Tick Values

xax = icdf(pd,xaxt(:)); % Corresponding Data Value Extimates, Based On 'pd'

xv = linspace(0, 1, numel(xax)); % Corresponding Axis X-Values

x1v = linspace(0, 1, numel(x1)); % Corresponding Axis X-Values

x1axt = interp1(pcv,pc,xaxt); % Interpolate Axis X-Values To Data X-Values

figure

semilogy(x1v, pc, '+')

% hold on

% plot(xv, xax, '--k')

% hold off

grid

Ax = gca;

set(Ax, 'XTick',xv, 'XTickLabel',xaxt)

Ax.XTickLabelRotation = -90;

xlim([0 1])

xlabel('Probability')

ylabel('Data')

.

### More Answers (1)

Paul
on 4 Oct 2022

Using same example data as above ...

x1 = wblrnd(3,3,[500,1]);

figure

probplot('weibull',x1)

grid

set(gca,'XDir','reverse')

view([90 90])

### See Also

### Categories

### Community Treasure Hunt

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

Start Hunting!