% Generating random variable W W = lognrnd(0, 0.05, 1, 2000); % Shifting W to have lognormal random variable w with zero mean and % has a support of [-1, Inf) w = W - 1; % Transforming omega to s_w = a*w with a = 9.0083 s_w = 9.0083*w; % My aim is now to integrate s_w from -1 to 0 and from 0 to Inf % Since I can only integrate a continous random variable numerically I % tried to hard code the density and use the integral function %mu = mean(s_w); %sigmasq = var(s_w); %s_w = @(x) exp(-(log(x) - mu).^2./(2.*sigmasq)./(x.*sqrt(2.*pi.*sigmasq))); %S_neg = integral(@(x)s_w(x), -1, 0); %S_pos = integral(@(x)s_w(x), 0, Inf); %d = -S_neg/S_pos; % This does obviously not work because of the support of log yet I actually % need to integrate % Even my approach of tranforming W to s(W) doesn't work since both values % are close to zero which they shouldn't be according to a density plot s_W = 9.0083*W; mu = mean(s_W); sigmasq = var(s_W); s_W = @(x) exp(-(log(x) - mu).^2./(2.*sigmasq)./(x.*sqrt(2.*pi.*sigmasq))); S_neg = integral(@(x)s_W(x), (-1+mu), mu); S_pos = integral(@(x)s_W(x), mu, Inf); d = -S_neg/S_pos;
I hope I gave all the necessary information.
For the edited version of your post,
a=-1+mu; b=mu; sigma=sqrt(sigmasq); Sneg = logncdf(b,mu,sigma) - logncdf(a,mu,sigma); Spos = logncdf(b,mu,sigma,'upper');
Matlabsolutions.com provides guaranteed satisfaction with a
commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain
experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support
to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been
empanelled after extensive research and quality check.
Matlabsolutions.com provides undivided attention to each Matlab
assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services
include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work
done at the best price in industry.