X, Y, Z, and C cannot be complex.
Afficher commentaires plus anciens
Hi all, Could you please help me to figure out the error? After I run this code:
clear all
clc
warning off
DELTA_F = 0.05;
DELTA_I = 0.05;
TFPF_to_TFPI = 2.1901;
ALPHA_I = 0.2;
MU = 1.006;
elasticity_F_I = 8;
E = 1-(1/elasticity_F_I);
GAMMA = (MU^(-0.35+ALPHA_I)/TFPF_to_TFPI)^(1/ALPHA_I);
TAUN = .1142;
TAUY = .07223;
RHOA = 0.94;
RHOG = 0.72;
SIGMA_a = 0.0006;
OMEGA_a = 0.95;
OMEGA_g =0.95;
CHII=0;
CHIFvec = linspace(0.01, 0.99,5);
SIGMA_gvec = linspace(0.001, 0.01,5);
result = zeros(length(CHIFvec),length(SIGMA_gvec));
[XX,YY] = meshgrid(CHIFvec,SIGMA_gvec);
for fl=1:length(CHIFvec)
CHIF = CHIFvec(fl);
for sl=1:length(SIGMA_gvec)
SIGMA_g= SIGMA_gvec(sl);
%%%%%%%%%%%%%%%%%%%
% Solving Model
%%%%%%%%%%%%%%%%%%%
[fx,fxp,fy,fyp] = benchmark_model(RHOA,SIGMA_a,RHOG,SIGMA_g,TAUN,TAUY,E,GAMMA,OMEGA_a,OMEGA_g,DELTA_F,DELTA_I,ALPHA_I,CHIF,CHII);
[gx,hx] = gx_hx(fy,fx,fyp,fxp);
% Analytical-Model-Based HP Second Moments
varshock = zeros(size(hx,1));
varshock(4,4) = SIGMA_a^2;
varshock(5,5) = SIGMA_g^2;
[var_y,var_x] = mom(gx,hx,varshock,0); %Compute Variance/covariance matrix
[var_y1,var_x1] = mom(gx,hx,varshock,1); %First-order autocovariance
table_modelmoms(1:13,1) = (diag(var_y(1:13,1:13)).^(1/2))*100;
table_modelmoms(1:13,2) = diag(var_y1(1:13,1:13)) ./ diag(var_y(1:13,1:13));
table_modelmoms(1:13,3) = var_y(1:13,1) ./ (diag(var_y(1:13,1:13)).^(1/2)) /var_y(1,1)^(1/2); % corrs with yF
table_modelmoms(1:13,4) = var_y(1:13,10)./ (diag(var_y(1:13,1:13)).^(1/2)) /var_y(10,10)^(1/2);% corrs with yI
table_modelmoms(1:13,5) = var_y(1:13,8) ./ (diag(var_y(1:13,1:13)).^(1/2)) /var_y(8,8)^(1/2); % corrs with y
% Table of serial correlation Labor and Output
MOMS_hp_model = ...
[table_modelmoms(1,1); % std(yF)*100 %1
table_modelmoms(2,1)/table_modelmoms(1,1); % std(cF)/std(yF) %2
table_modelmoms(3,1)/table_modelmoms(1,1); % std(ivF)/std(yF); %3
table_modelmoms(7,1)/table_modelmoms(1,1); % std(tby)/std(yF); %4
table_modelmoms(1,2); % corr(yF_t,yF_t-1);%5
table_modelmoms(2,3); % corr(yF,cF); %6
table_modelmoms(3,3); % corr(yF,ivF); %7
table_modelmoms(7,3); % corr(yF,tby); %8
table_modelmoms(6,1)/table_modelmoms(1,1); % std(h)/std(yF); %9
table_modelmoms(6,3); % corr(yF,h); %10
table_modelmoms(4,1)/table_modelmoms(1,1); % std(hF)/std(yF); %11
table_modelmoms(5,1)/table_modelmoms(1,1); % std(hI)/std(yF); %12
table_modelmoms(4,3); % corr(yF,hF); %13
table_modelmoms(5,3); % corr(yF,hI); %14
table_modelmoms(5,4)]; % corr(hI,hF); %15
end
result(fl,sl) = table_modelmoms(5,3);
end
surf(XX,YY,result)
xlabel('CHIF')
ylabel('SIGMA')
zlabel('Corr')
I got this error:
Error using surf (line 82)
X, Y, Z, and C cannot be complex.
Error in benchmark_model_run (line 80)
surf(XX,YY,result)
I would greatly appreciate if you could help me to solve this issue. Best
2 commentaires
Torsten
le 23 Avr 2018
result(fl,sl) seems to be complex-valued for some combination of fl and sl.
Best wishes
Torsten.
AYSEGUL DILSIZ
le 23 Avr 2018
Réponses (0)
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!