I want to simulate the demand of a factory. This is not a real problem, the demand follows this relation $D= AB^2C^3$ where $A$, $B$ and $C$ have normal distributions: $$A\sim N(10,2.5),\quad B\sim(6,0.4),\quad C\sim(5,0.9).$$
I have the covariance matrix of this problem which is $$\text{cov}_x=\begin{bmatrix}2.5&0.1&0.2\\0.1&0.4&0.3\\0.2&0.3&0.9\end{bmatrix}.$$
The problems asks to
Generate demand data in a non-correlated context and use eigenvalue and eigenvector for this.
Fit these demands using the Kumaraswamy distribution function, which is $$Z= Z_\min + (Z_\max-Z_\min)(1-(1-F(Z))^{1/b})^{1/a}$$
I attach my code below. I don't know why this code has an error.
clc
clear
cov_x=[2.5 0.1 0.2;0.1 0.4 0.3;0.2 0.3 0.9];
E_x=[10 6 5];
[V, landa]=eig(cov_x);
E_w=V'*E_x';
var_w= landa;
W=repmat(E_w,1,1000)+sqrt(var_w)*(randn(3,1000));
X=V*W;
A= X(1,:); B= X(2,:); C=X(3,:);
%D= A'*B.^2*C.^3';
for k=1:1000
D(:,k)=A(:,k)'*B(:,k).^2*C(:,k).^3;
end
%now we use kumara
Z=sort(D);
FZ= @(i)i/1001;
f=@(y,FDS) y(1)+((y(2)-y(1)).*((1-((1-FDS).^(1/y(3)))).^(1/ y(4))));
y0=[0.1 0.1 0.1 0.1];
y =lsqcurvefit(f,y0,FZ,Z)