Effacer les filtres
Effacer les filtres

cumulative distribution function

2 vues (au cours des 30 derniers jours)
fatemeh
fatemeh le 9 Mai 2015
Hi everyone I want to write a formula that includes inverse cumulative distribution function and cumulative distribution function. I'm going to apply this formula on the two matrix called obs and his. These functions should be applied by column to data matrix. I wrote the following code in matlab but I got the wrong results. Some output data were negative. Here is formula link. Would it be possible for direct me. Any suggestions would be appreciated. https://www.dropbox.com/s/2pflf60qrbduh8j/aa.jpg?oref=e&n=71002171
XHIS=zeros(30,12);
his=xlsread('sample data.xls','his','b2:m31'); %his input
obs=xlsread('sample data.xls','obs','b2:m31'); %obs input
for i=1:12
fhis=normcdf(his(:,i),mean(his(:,i)),std(his(:,i))); %cdfhis
hisinv=norminv(fhis,mean(his(:)),std(his(:))); %inversehis
fobs=normcdf(obs(:,i),mean(obs(:,i)),std(obs(:,i))); %cdfobs
obsinv=norminv(fobs,mean(obs(:)),std(obs(:))); %inverseobs
%%%%%%%%%%%%%%%%%%%%%%
outhis =interp1(his(:,i),fhis,his(:,i),'nearest','extrap'); %cdfhis(xhis)
[unifobs,ind]=unique(fobs);
obsinv=obsinv(ind);
XHIS(:,i)=interp1(unifobs,obsinv(:),outhis,'nearest','extrap'); %cdfinverseobs(cdfhis(xhis))
End
Regards

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by