代写 matlab PROJECT 3

PROJECT 3
Econ 3544 Computer-Based Modeling – Summer 2019
Please submit (by e-mail) due on Saturday, July 20, 2019.
The mail subject should be: “pr3_E3544_your last name” (lower case letters). Attach the script file to your mail. Make sure that your submitted script runs without errors. Use a semicolon at the end of each code line to suppress unnecessary printing.
Using Matlab editor create a script named “pr3_your last name.m” (lower case letters).
The cobweb model is based on a time lag between supply and demand decisions. To have an idea about the model, consider a situation in which the producer’s output decision must be made one period in advance; for example, suppose that, as a result of an unexpectedly bad productive year of good 𝐺, producers go to market with an unusually small production. This shortage, equivalent to a leftward shift in the market’s supply curve, results in high prices. If producers expect these high price conditions to continue in the following year, they will raise the production of 𝐺, and when they go to market the supply will be high, resulting in low prices. Then if low prices are expected to continue, producers will decrease the production of 𝐺, resulting again in higher prices. As this process repeats itself, oscillating between periods of low supply with high prices and high supply with low prices.
This set price-quantity may spiral inwards and the economy converge to the
equilibrium or it may spiral outwards and the economy diverges since the fluctuations
increase in magnitude.
Assume that the output decisions in time 𝑡 are based on the current price, 𝑃 . Since 𝑡
this output will not be available for the sale until the next period time 𝑡 + 1, 𝑃 𝑡
determines 𝑄 or, equivalently, 𝑃 affects 𝑄 , which interacting with a demand 𝑠,𝑡+1 𝑡−1 𝑠,𝑡
function, imposes dynamic price patterns. The standard equations that characterize the market are:
̅
𝑄 =𝑄−𝑎𝑃
𝑑,𝑡 𝑑 𝑡
̅
𝑄 =𝑄+𝑏𝑃
𝑠,𝑡 𝑠 𝑡−1 𝑄𝑑,𝑡 = 𝑄𝑠,𝑡
The endogenous variables are: quantity demanded, 𝑄𝑑,𝑡; quantity offered, 𝑄𝑠,𝑡; and price of the good, 𝑃 . The exogenous variables are: independent/autonomous quantity
𝑡 ̅̅
demanded, 𝑄𝑑; independent/autonomous quantity offered, 𝑄𝑠; and the price of the good in the previous period, 𝑃 . Parameters are: 𝑎, 𝑏 > 0, respectively, the
𝑡−1
sensitivity of the demand to price at time 𝑡 and the sensitivity of the supply to price at
time 𝑡 − 1.
By substituting 𝑄𝑑,𝑡 and 𝑄𝑠,𝑡 in 𝑄𝑑,𝑡 = 𝑄𝑠,𝑡, the model can be reduced to a single first- order difference equation,
̅̅ 𝑎𝑃+𝑏𝑃 =𝑄−𝑄
which, since a ≠ 0, can be rewritten as
𝑃 = − (𝑏) 𝑃 + 𝑄𝑑 − 𝑄𝑠 𝑡+1 𝑎𝑡 𝑎
𝑡 𝑡−1 𝑑 𝑠
̅̅

Write a script that solves the above problem and plots the traces of price and quantity over time by considering the following:
Qd_bar = 35;
a = 4; % Qdt = Qd_bar – a*P_t
Qs_bar = 5;
b = 2; % Qst = Qs_bar + b*P_t-1
T = 20; % number of periods
P(1) = 2 ; % initial price
Q(1) = NaN; % initial quantity