Clear Filters
Clear Filters

Plotting multiple numerical solutions of a non-polynomial equation

3 views (last 30 days)
Hi all,
I am a rather inexperienced MATLAB user with some very complex issue at hand for my thesis. Essentially, my problem is twofold. First, I want to approximate (all, or at least multiple) solutions for the following equations:
FOCemployee: 2*delta*m == b*exp(-2*m) + 0.5*b*exp(-m)
FOCfirm: (12-b)*0.25*(2*exp(-2*m)+exp(-m)*((2*exp(-2m)+1*exp(-m))/(2*delta-b*0.5(-4*exp(-2*m)-exp(-m))))-0.5(1-exp(-2*m)+1-exp(-m)) == 0
In particular, these equations are non-polynomial and hence vpasolve does not return all its solutions. Unfortunately I have not been able to find any other code that yields multiple solutions for those specific functions.
What I want to do with these solutions is essentially to depict how the optimal effort level (m*) and corresponding bonus (b*) change with the delta, preferably in two seperate graphs where the delta is on the x-axis. In general, I want to do this for some other functions as well, but I reckon that if I understand this particular case I might be able to infer the solutions to those cases.The range of delta for which I want to find the optimal effort and corresponding optimal bonus is from 0 to 1.
Can anybody please help me to accomplish this? I am using MATLAB R2017b. What I want looks essentially similar to Figure 1 on page 19 of this document: http://economics.sas.upenn.edu/~hfang/publication/giuseppe/jme_online.pdf
Kind regards,
Lennart

Answers (1)

Roger Stafford
Roger Stafford on 8 Nov 2017
Edited: Roger Stafford on 8 Nov 2017
One possibility is to use ‘fsolve’ on the two equations. You will need to give initial starting values for ‘m’ and ‘b’, and by varying these it will allow you to seek multiple solutions.
Another method would be to use the first equation to express ‘b’ entirely in terms of ‘m’ and ‘delta’ and then substitute that expression into the two places in the second equation where ‘b’ occurs. That will give you a single equation in the single unknown ‘m’. You can use ‘fzero’, again with various initial starting values.
Also with the above single equation and single unknown you can attempt to solve it symbolically using ‘solve’. Perhaps it would give you multiple solutions.
In all of the above you will need to do the above for numerous values of ‘delta’ in order to produce valid plots. It will presumably require a lot of effort.
  2 Comments
Lennart Cox
Lennart Cox on 9 Nov 2017
Hi Roger,
Thanks for your reply. Could you indicate which method would be less time-consuming/easier, considering that I am not very familiar with MATLAB yet? Regarding delta, can't it be done without simply reiterating the problem with different values of delta?
Kind regards,
Lennart
Lennart Cox
Lennart Cox on 9 Nov 2017
Hi Roger,
I have been specifying solutions for different values of delta using fsolve. I then get several solutions, specified as 2x1 doubles. Now I want to plot both m and b seperately to those values of delta. Unfortunately, I am not able to do this due to the output of fsolve. Any tips?
if true
function F = FOCdelta017p050(X) %adjust name based on changes from FOC
m = X(1);
b = X(2);
delta = 0.17; %adjustable
ph = 0.5; %adjustable
pl = 1 - ph;
qh = 0.5; %adjustable
ql = 1 - qh;
ah = 2; %adjustable
al = 1; %best to keep the same
y = 6; %only need to fix this once
prodh = 1 - exp(-ah*m);
d_prodh = ah*exp(-ah*m);
d2_prodh = ah*(-ah)*exp(-ah*m);
prodl = 1 - exp(-al*m);
d_prodl = al*exp(-al*m);
d2_prodl = al*(-al)*exp(-al*m);
cost = delta*m^2;
d_cost = 2*delta*m;
d2_cost = 2*delta;
d_m_b = (ph*d_prodh + pl*d_prodl)/(d2_cost - b*(ph*d2_prodh + pl*d2_prodl));
F(1) = b*(ph*d_prodh + pl*d_prodl) - d_cost; F(2) = (y-b)*(qh*d_prodh + ql*d_prodl)*d_m_b - (qh*prodh + ql*prodl); end
Then, I have solved this for each value of delta using
if true
FOCsolution = @FOCdelta001p050;
X0 = [0; 0];
FOCsolutionDelta001 = fsolve(FOCsolution,X0);
end
How can I now create these graphs, without doing too much manually preferably?

Sign in to comment.

Categories

Find more on Interpolation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!