Hello everybody,
I'm trying to get this graph:
Using this code:
function res = fun(bs,gamma)
fun_ode = @(b,z)[(1-gamma)*z(1)/(z(2)-b);z(2)/(z(1)-b);z(1)];
z0=[1 1 0];
[B,Z] = ode45(fun_ode,[bs,0],z0);
res = bs - 0.5*(1+gamma*Z(end,3));
end
gamma = 0.3;
bs = 0.542
fun_ode = @(b,z)[(1-gamma)*z(1)/(z(2)-b);z(2)/(z(1)-b);z(1)];
z0=[1 1 0];
[B,Z] = ode45(fun_ode,[bs,0],z0);
hold on
plot(B,Z(:,1),'r')
plot(B,Z(:,2),'b')
hold off
grid on
Error using fplot>singleFplot (line 258)
Input must be a function or functions of a single variable.

Error in fplot>@(f)singleFplot(cax,{f},limits,extraOpts,args) (line 218)
hObj = cellfun(@(f) singleFplot(cax,{f},limits,extraOpts,args),fn{1},'UniformOutput',false);

Error in fplot>vectorizeFplot (line 218)
hObj = cellfun(@(f) singleFplot(cax,{f},limits,extraOpts,args),fn{1},'UniformOutput',false);

Error in fplot (line 184)
hObj = vectorizeFplot(cax,fn,limits,extraOpts,args);
But I didn't get it. I would appreciate it if I could get the graph.

 Réponse acceptée

Torsten
Torsten le 29 Juil 2024
Modifié(e) : Torsten le 29 Juil 2024

0 votes

According to proposition 4, the red curve should be the inverse bidding function X and the blue curve should be the inverse bidding function Y for the given value of gamma.
gamma = 0.3;
bs0 = 0.3;
bs = fsolve(@(b)fun(b,gamma),bs0,optimset('Display','None'))
bs = 0.4509
fun_ode = @(b,z)[(1-gamma)*z(1)/(z(2)-b);z(2)/(z(1)-b);z(1)];
z0=[1 1 0];
[B,Z] = ode45(fun_ode,[bs,0],z0);
hold on
plot(B,Z(:,1),'r')
plot(B,Z(:,2),'b')
hold off
grid on
function res = fun(bs,gamma)
fun_ode = @(b,z)[(1-gamma)*z(1)/(z(2)-b);z(2)/(z(1)-b);z(1)];
z0=[1 1 0];
[B,Z] = ode45(fun_ode,[bs,0],z0);
res = bs - 0.5*(1+gamma*Z(end,3));
end

Plus de réponses (1)

Walter Roberson
Walter Roberson le 27 Juil 2024

0 votes

b is not defined.
This is the same problem as you had for your previous iteration of this question (which you have deleted.) I pointed out the problem there.

3 commentaires

Researcher DSGE
Researcher DSGE le 29 Juil 2024
Dear Walter,
The graphing itself is quite simple, the issue is to get the x and y coordinates for the bidders' values and bids.
I remember that it was necessary to numerically approximate values that fulfill the equations in Proposition 4 for it to be solved. I do not remember the specific procedure I used (only that it was relatively simple and sufficient to reach convergence).
(the integral in (8) has a typo, it is an integral over the interval 0, b(upper bar))
I am sorry that I cannot help you further at this time.
syms v a
gamma=0.3;
b_hat=0.542;
fun = v/2;
B(v) = int(fun, v, 0, a)
B(v) = 
fplot(B,[0 1])
Error using fplot>singleFplot (line 258)
Input must be a function or functions of a single variable.

Error in fplot>@(f)singleFplot(cax,{f},limits,extraOpts,args) (line 218)
hObj = cellfun(@(f) singleFplot(cax,{f},limits,extraOpts,args),fn{1},'UniformOutput',false);

Error in fplot>vectorizeFplot (line 218)
hObj = cellfun(@(f) singleFplot(cax,{f},limits,extraOpts,args),fn{1},'UniformOutput',false);

Error in fplot (line 184)
hObj = vectorizeFplot(cax,fn,limits,extraOpts,args);
You are defining B to be a function of v. But you are integrating over v with definite integral bounds that are independent of v, so the result will be independent of v. As a result, B(v) is independent of v, and is instead dependent on the constant a
Torsten
Torsten le 29 Juil 2024
Modifié(e) : Torsten le 29 Juil 2024
I don't understand the relation between your graphs and Proposition 4. What is v ? Why is b plotted as y-axis and not as x-axis for it seems to be the independent variable ?

Connectez-vous pour commenter.

Catégories

En savoir plus sur Mathematics dans Centre d'aide et File Exchange

Produits

Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by