1. Normal Distribution
관련 MATLAB 함수: normpdf, normcdf, norminv, normrnd
--- MATLAB code ---
% normal distribution
mu = 10;
sigma = 2;
x = 0:0.1:mu*2;
y = normpdf(x,mu,sigma); % normal pdf 값
plot(x, y)
y = normcdf(x, mu, sigma); % normal cdf 값
plot(x, y)
y = norminv(0.5, mu, sigma) % normcdf의 역함수
normrnd(mu, sigma, 2) % normpdf에 맞게 난수 생성
2. Lognormal Distribution
관련 MATLAB 함수: lognpdf, logncdf, logninv, lognrnd
--- MATLAB code ---
% lognormal distribution
mu = 3;
sigma = 1;
x = 0:0.1:mu*10;
y = lognpdf(x,mu,sigma); % lognormal pdf 값
plot(x, y)
y = logncdf(x, mu, sigma); % lognormal cdf 값
plot(x, y)
y = logninv(0.5, mu, sigma) % lognormcdf의 역함수
lognrnd(mu, sigma, 2) % lognormpdf에 맞게 난수 생성
3. Chi-Square Distribution
관련 MATLAB 함수: chi2pdf, chi2cdf, chi2inv, chi2rnd
--- MATLAB code ---
% Chi-Square distribution
nu = 10;
x = 0:0.1:nu*2;
y = chi2pdf(x,nu); % Chi-Square distribution pdf 값
plot(x, y)
y = chi2cdf(x, nu); % Chi-Square distribution cdf 값
plot(x, y)
y = chi2inv(0.5, nu) % Chi-Square distribution cdf의 역함수
chi2rnd(nu, 2) % Chi-Square distribution pdf에 맞게 난수 생성
4. t-Distribution
관련 MATLAB 함수: tpdf, tcdf, tinv, trnd
--- MATLAB code ---
% t-distribution
nu = 5;
x = -nu*2:0.1:nu*2;
y = tpdf(x,nu); % t-distribution pdf 값
plot(x, y)
y = tcdf(x, nu); % t-distribution cdf 값
plot(x, y)
y = tinv(0.7, nu) % t-distribution cdf의 역함수
trnd(nu, 2) % t-distribution pdf에 맞게 난수 생성
5. F-Distribution
관련 MATLAB 함수: fpdf, fcdf, finv, frnd
--- MATLAB code ---
% F-distribution
nu1 = 5;
nu2 = 25;
x = 0:0.1:nu1*2;
y = fpdf(x, nu1, nu2); % F-distribution pdf 값
plot(x, y)
y = fcdf(x, nu1, nu2); % F-distribution cdf 값
plot(x, y)
y = finv(0.5, nu1, nu2) % F-distribution cdf의 역함수
frnd(nu1, nu2, 2) % F-distribution pdf에 맞게 난수 생성
6. Uniform Distribution
관련 MATLAB 함수: unifpdf, unifcdf, unifinv, unifrnd
--- MATLAB code ---
% uniform distribution
a = 5;
b = 10;
x = 0:0.1:15;
y = unifpdf(x, a, b); % uniform distribution pdf 값
plot(x, y)
y = unifcdf(x, a, b); % uniform distribution cdf 값
plot(x, y)
y = unifinv(0.5, a, b) % uniform distribution cdf의 역함수
unifrnd(a, b, 2) % uniform distribution pdf에 맞게 난수 생성
7. Exponential Distribution
관련 MATLAB 함수: exppdf, expcdf, expinv, exprnd
--- MATLAB code ---
% exponential distribution
lambda = 1;
x = 0:0.1:10;
y = exppdf(x, lambda); % exponential distribution pdf 값
plot(x, y)
y = expcdf(x, lambda); % exponential distribution cdf 값
plot(x, y)
y = expinv(0.5, lambda) % exponential distribution cdf의 역함수
exprnd(lambda, 2) % exponential distribution pdf에 맞게 난수 생성
8. Gamma Distribution
관련 MATLAB 함수: gampdf, gamcdf, gaminv, gamrnd
--- MATLAB code ---
% gamma distribution
lambda = 2;
k = 3;
x = 0:0.1:10;
y = gampdf(x, k, 1/lambda); % gamma distribution pdf 값
plot(x, y)
y = gamcdf(x, k, 1/lambda); % gamma distribution cdf 값
plot(x, y)
y = gaminv(0.5, k, 1/lambda) % gamma distribution cdf의 역함수
gamrnd(k, 1/lambda, 2) % gamma distribution pdf에 맞게 난수 생성
9. Weibull Distribution
관련 MATLAB 함수: wblpdf, wblcdf, wblinv, wblrnd
--- MATLAB code ---
% Weibull distribution
scale = 1; % scale parameter
shape = 2; % shape parameter
x = 0:0.001:3;
y = wblpdf(x, scale, shape); % Weibull distribution pdf 값
plot(x, y)
y = wblcdf(x, scale, shape); % Weibull distribution cdf 값
plot(x, y)
y = wblinv(0.5, scale, shape) % Weibull distribution cdf의 역함수
wblrnd(scale, shape, 2) % Weibull distribution pdf에 맞게 난수 생성
'MATLAB' 카테고리의 다른 글
MATLAB에서 csv 파일 및 txt 파일 읽고 쓰기 (0) | 2020.11.10 |
---|---|
MATLAB-Python 연결하는 방법 3 (2) | 2020.10.22 |
MATLAB-Python 연결하는 방법 2 (0) | 2020.10.22 |
MATLAB-Python 연결하는 방법 1 (0) | 2020.09.23 |
MATLAB의 fmincon 함수로 최적화 문제 풀기 (4) | 2020.04.13 |