How to simulate the outage probability using Matlab?

14 views (last 30 days)
Can any one help me ?? i want to simulate my CDF (or outage) equation and i have never done the simulation before, can anyone send me a sample code on Matlab to learn how to do it?

Answers (1)

the cyclist
the cyclist on 17 Dec 2016
Does the answer to this question help you?
  5 Comments
Deema42
Deema42 on 18 Dec 2016
function [f,F] = EstimateDistribution(X,x) % Checking Input Arguments if nargin<2||isempty(x), x = linspace(-10,10,1000);end if nargin<2||isempty(X) error('Missing Input Arguments: Please specify vector random variables'); end
% Impelementation Starts Here f = zeros(1,length(x)); % Preallocation of memory space F = f; % Preallocation of memory space h = 0.000000001; % Small value closer to zero for evaluating % numerical differentiation.
% Estimating CDF by its definition for m = 1:length(x) p = 0; % True Probability q = 0; % False Probability for n = 1:length(X) if X(n)<=x(m) % Definition of CDF p = p + 1; else q = q + 1; end end F(m) = p/(p + q); % Calulating Probability end
% Estimating PDF by differentiation of CDF for k = 1:length(x) fxph = interp1(x,F,x(k) + h,'spline'); % Interpolating value of F(x+h) fxmh = interp1(x,F,x(k) - h,'spline'); % Interpolating value of F(x-h) f(k) = (fxph - fxmh)/(2*h); % Two-point formula to compute end % Numerical differentiation f = smooth(f);
Deema42
Deema42 on 18 Dec 2016
Edited: Deema42 on 18 Dec 2016
sorry for the delay, these are two codes i found on Mathworks, they are fine, i want to do exactly like this but for a different PDF and CDF, mine is for cascaded Rician random variable, so the pdf is different than a normal rician. how can i modify this code?? if you like, i can send you my PDF and CDF equations.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!