Integration of the expected value
4 ビュー (過去 30 日間)
古いコメントを表示
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.
and plot it. 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 件のコメント
採用された回答
Torsten
2022 年 8 月 2 日
編集済み: Torsten
2022 年 8 月 3 日
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)
その他の回答 (1 件)
William Rose
2022 年 8 月 2 日
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.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



