Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
Please experts help me to check this code and comment if error please
조회 수: 1 (최근 30일)
이전 댓글 표시
clear all;
clc;
N = 1000;
% standard normal distribution mean=0 and variance =1
norm_mean=0;
norm_var=1;
%generating random variable with standard normal distribution
r1= norm_mean+sqrt(norm_var)*randn(1,N)
figure;
hist(r1)
r2= norm_mean+sqrt(norm_var)*randn(1,N);
figure;
hist(r2)
%u= copularndn('Gaussian',r1,r2)
figure
scatterhist(r1,r2)
%normal distribution PDF
xPDF= normpdf(r1,norm_mean,sqrt(norm_var));
figure;
hist(xPDF)
yPDF =normpdf(r2,norm_mean,sqrt(norm_var));
figure;
hist(yPDF)
%calculate normal distribution cdf
pd = makedist('Normal',norm_mean,sqrt(norm_var));
%compute the cdf values for the standard normal distribution at the values
%in random variables
y1 = cdf(pd,r1);
figure;
hist(y1)
y2 = cdf(pd,r2);
figure;
hist(y2)
figure
scatterhist(y1,y2)
%calculating correlation
rho= corr(y1(:),y2(:)) %rho is correlation coefficient
%calculating Gaussian/Normal copula
u=copularnd('Gaussian',rho,N)
figure;
scatterhist(u(:,1),u(:,2))
[SL: formatted the code as code]
댓글 수: 0
답변 (0개)
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!