Bias correction - normcdf and norminv giving 'Inf' values

I am correcting a simulated daily time-series of temperature using observations, then applying this correction to the rest of the time-series for which there are no observations. This is done on a monthly basis using distribution mapping.
However, when applying the correction to simulated values 'Inf' values are produced where the standard deviation is low (e.g. < 0.3), which causes the cdf value generated using normcdf to reach 1. I would like to find a way around this - I'm not sure if it's something wrong with the code itself or if I should use another function.
Here is a section of the code. Prior to this, the mean/sd of observed and simulated were calculated producing the attached matrix (mean_obs, stdev_obs, mean_sim_ref, stdev_sim_ref).
%read parameters from calibration BC process,
mean_obs = zz(mm,1);
stdev_obs = zz(mm,2);
mean_sim_ref = zz(mm,3);
stdev_sim_ref = zz(mm,4);
n = numel(Tas);
tas_cor_ref = zeros(n,1); %pre-allocate x_cor_ref
for a = 1:n
%calculate the cdf of each simulated value using
%are the mean and standard deviation, obtained from zz
cdfval = normcdf(Tas(a),mean_sim_ref, stdev_sim_ref);
%calculate the inverse of this normal cdf
%x_cor_ref are corrected values
tas_cor_ref(a) = norminv(cdfval,mean_obs,stdev_obs);
end

답변 (0개)

카테고리

제품

질문:

2015년 9월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by