Weibull does not seem to work gives error"Error using makedist Distribution name 'Weibull' is unrecognized."

7 vues (au cours des 30 derniers jours)
c = 8.1; % Scale factor
k = 2.03; % Shape factor
N = 1000; % Number of plot data points
pd = makedist('Weibull','a',c,'b',k) %Selection of Weibull
x = linspace(0,25,N);
y = pdf(pd,x); % Weibull output function
cd = 1 - exp(-(x/c).^k); % Cumulative distribution
yyaxis left
plot(x,100*y, 'k','LineWidth',2)
title({['Weibull and Cumulative Probability Distributions'], ...
['k = ', num2str(k), ' and c = ', num2str(c)]});
xlabel('Wind Velocity (m/s)');
ylabel('Probability (%)', 'Color','k');
hold on
yyaxis right
plot(x,100*cd, 'r','LineWidth',2)
ylabel('Probability (%)');
legend('Weibull', 'Cumulative')
axis([0 25 0 120]);
grid on
grid minor
It gives the following error:
Error using makedist
Distribution name 'Weibull' is unrecognized.
  1 commentaire
Ganapathi Subramanian R
Ganapathi Subramanian R le 3 Juin 2024
Hi Gihahn,
The above script is working fine for me in MATLAB R2023b. Could you let me know which version of MATLAB you are using?
Additionally, to execute the above code you should have a valid license to access Statistics and Machine Learning Toolbox.

Connectez-vous pour commenter.

Réponses (1)

Jayanti
Jayanti le 30 Sep 2024
Hi Gihahn,
If you want to use Weibull distributions in MATLAB, particularly functions like makedist, pdf you need to have the Statistics and Machine Learning Toolbox installed. Your error suggests that you don’t have the Statistics and Machine Learning Toolbox installed. When I tried running the code without this toolbox, I faced the same issue.
You can also try running the “ver” command to find the product name, version number, and release name for all the Matlab and other installed products.
However, after installing the Statistics and Machine Learning Toolbox the code no longer throws errors.
I hope this helps you!

Tags

Produits


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by