Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Please experts help me to check this code and comment if error please

1 Ansicht (letzte 30 Tage)
Nirajan Khatri
Nirajan Khatri am 24 Sep. 2020
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
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]

Antworten (0)

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by