{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

cakecodeECO2

# cakecodeECO2 - 1b Write down code to solve this problem for...

This preview shows pages 1–3. Sign up to view the full content.

1b. Write down code to solve this problem for arbitary number of parameters, but make sure your routine is stable to solve the problem for high values of σ %%%%%code for problem 1b%%%%% %%%wrote the following function and saved as cake1b.m file%%%%% function F = cake1b(w) beta = 0.95; R = 0.25; sigma = .45; betaR = (beta * R)^(1/sigma); T = length(w); F = ones(T, 1); wbar = 100; w = [wbar; w; 0]; for t= 2:(T+1) F(t-1) = betaR*(R*w(t-1)-w(t)) - (R*w(t)-w(t+1)); end %%%%%%placed the following in the command window%%%%%% plot(1:T+2,w, ':ks'); legend('W') xlabel('time') ylabel('W') title('Plot of W') pause(.001) w0 = ones(10, 1); options=optimset('Display','off'); [w,fval,exitflag] = fsolve(@cake1b,w0,options) %%%output: 14 end

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
1c. Modify your code to incorporate a new law of motion %%%%%code for problem 1b%%%%% %%%wrote the following function and saved as cake1c.m file%%%%% function F = cake1c(w) beta = 0.95; R = 0.25; sigma = 0.45; betaR = (beta * R)^(1/sigma); T = length(w); F = ones(T, 1);
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 5

cakecodeECO2 - 1b Write down code to solve this problem for...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online