Integration of the expected value
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Dear community!
I have an interval and an expected price which is laying on this interval. b is a constant.
I want to find all possible values of expected profit function which is expressed as and plot it.
is a c.d.f. of uniformly distrtubited density function .
Integrating by parts the expected price can be re-written as: . So, I am trying to write the following code, which doesn't work:, please see below. Any help will be highly apprerciated!
b = 1;
p = (0:0.01:b);
p_e = (p:0.01:b);
pd1 = makedist('Uniform','lower',p,'upper',b);
G = @(p) p + p * cdf - int((cdf), p, p, b);
y=G(p);
plot(p,y)
xlim([0 1])
ylim([0 +inf])
leg = legend('Expected profit','AutoUpdate','off');
title(leg,'Expected profit')
xlabel('Price')
ylabel('Expected Profit')
% put the grid on top of the colored area
set(gca, 'Layer', 'top')
grid on
0 Commenti
Risposta accettata
Torsten
il 2 Ago 2022
Modificato: Torsten
il 3 Ago 2022
b = 1;
N = 2000000;
for i = 1:N
p(i) = b*rand;
pe(i) = p(i) + (b-p(i))*rand;
p2(i) = p(i) + pe(i);
end
ecdf(pe)
mean(p)
mean(pe)
mean(p2)
Più risposte (1)
William Rose
il 2 Ago 2022
I'm not sure I understand. Is a uniformly distributed random variable, or is the expected value of p, which is a uniformly distributed random variable? You wrote inside the integral in the first equation, but after that, the subscript e disappeared. If is the random variable inside the integral, then it should be the vrable of integration, so the integral should have been . If that is the case, then you have
where b and p are constants. Which is just what you expect for the mean value of a uniformly distributed random variable.
Perhaps you meant to write for the first equation. If so, there is a different problem, which is that p cannot be the lower limit of integration and the variable of integration at the same time.
1 Commento
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!