Calculating and Plotting Weibull Distribution Function(wblpdf) with Cell Arrays

22 views (last 30 days)
Hi, so I calculated weibull parameters for my cell array using this, where speedMsAWPcells is a set of 12 arrays.
weibullAWPcells = cellfun(@(C) wblfit(C), speedMsAWPcells, 'uniform', 0);
The output was the pairs of parameters as shown:
I would like to know how to apply the sets of weibull parameters to the weibull probability density function (wblpdf()) to calculate the individual wblpdf for each set of parameters in the cell array.
The range I am plotting the wblpdf for is as follows
X=0:0.5:27;
wblpdf(X,c,k);
% Where c = scale parameter, k = shape parameter
Lastly, I would like to know if there is some way to plot all of these wblpdfs against each other in the same plot without extracting them and then plotting them against each other, one at a time using hold on, hold off...

Accepted Answer

Paul
Paul on 15 Mar 2021
Here's an example that you might be able to adapt to your needs.
>> params = {[1 2];[2 3];[3 4]}; % define cell array with parameters for three Weibull densities
>> x=0:.1:5; % define x values to evaluate the densities
>> figure;hold on
>> p=cellfun(@(x,params) plot(x,pdf('Weibull',x,params(1),params(2))),repmat({x},size(params,1),1),params); % plot the densities, return handles to lines
>> set(p(1),'Marker','o'); % add some markers to the first line

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by