How to generate random values from tlocationscale distributions ?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I would like to create some random numbers with tlocationscale distribution.I am not sure how to do it. Thanks for any help.
0 commentaires
Réponses (1)
Anudeep Kumar
le 22 Avr 2025
Hey Rita,
In MATLAB, you can generate random numbers from a t location-scale distribution using the “makedist” and “random” functions.
Here is a sample code on how to achieve the goal:
% Parameters
mu = 0; % Location parameter
sigma = 1; % Scale parameter
nu = 5; % Degrees of freedom
N = 1000; % Number of random numbers
% Create the t location-scale distribution object
pd = makedist('tLocationScale', 'mu', mu, 'sigma', sigma, 'nu', nu);
% Generate random numbers
r = random(pd, N, 1);
% Display histogram
histogram(r, 30);
title('Random numbers from t location-scale distribution');
You can refer to this documentation for detail about the function and how you can modify it for your use case:
Hope it helps!
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!