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 个)

此问题已关闭。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by