MATLAB Answers

cumulative distribution function

1 view (last 30 days)
fatemeh on 9 May 2015
Edited: Star Strider on 9 May 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.
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)
XHIS(:,i)=interp1(unifobs,obsinv(:),outhis,'nearest','extrap'); %cdfinverseobs(cdfhis(xhis))

Answers (0)

Community Treasure Hunt

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

Start Hunting!