Info
This question is closed. Reopen it to edit or answer.
Using indicators to represent variables in a distribution (Indicator Transform)
1 view (last 30 days)
Show older comments
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);
0 Comments
Answers (0)
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!