How to generate random values from tlocationscale distributions ?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I would like to create some random numbers with tlocationscale distribution.I am not sure how to do it. Thanks for any help.
0 comentarios
Respuestas (1)
Anudeep Kumar
el 22 de Abr. de 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 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!