MATLAB Answers

Using indicators to represent variables in a distribution (Indicator Transform)

6 views (last 30 days)
Gumps on 8 Nov 2018
I would like some help on how I can use indicators such as i1 - i6 to represent different ranges of variables in a distribution. The reason for this is my variables are continous and my hope is to use the indicator transform to make it categorical before I can then go on with my other coding (perturbation of the probabilities). For the indicator, I(u) = K if Z(u)<=zk for all K=0.0001,....,k K+1 if Z(u)>zk currently I have this code and will be happy for anyone to help me out; mu = 300.45; sigma = 120.5; N2 = 100; Tpf = randn(N2,1)*sigma + mu; Tpfmin= -10; %upper bound Tpfmax = 650;%lower bound h2 = 60; % bin width edges = Tpfmin:h2:Tpfmax;
% Plot histogram and distribution hist = histc(Tpf,edges); figure; bar(edges,hist,'histc'); grid on grid minor
% Overlay the distribution hold; f = @(z) N2*h2*normpdf(z,mu,sigma); fplot(f,[Tpfmin Tpfmax]);
% Put up legend. legend2 = sprintf('Tpf mean = %.3f', mean(mu)); legend(legend2);


Sign in to comment.

Answers (0)

Sign in to answer this question.