How to generate random values from tlocationscale distributions ?
조회 수: 1 (최근 30일)
이전 댓글 표시
I would like to create some random numbers with tlocationscale distribution.I am not sure how to do it. Thanks for any help.
댓글 수: 0
답변 (1개)
Anudeep Kumar
2025년 4월 22일
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
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!