How to Plot Ramsey Phase Plane

10 visualizaciones (últimos 30 días)
econogist
econogist el 18 de Mayo de 2022
Comentada: econogist el 18 de Mayo de 2022
I am trying to plot the phase plane from the famous Ramsey macroeconomic model with Matlab's quiver. The system of equations are and . Most plots of the function look like the attachment. But what I want is to plot a bunch of arrows as is typically seen when you just google images of phase planes. This seems like it should be simple enough, but I'm stuck. How do I do this? What am I missing? Below is what I've done so far.
clc
clear all
alpha=0.5;
rho=0.8;
delta=0.3;
n=1;
g=1;
theta=1;
[k, c] = meshgrid(0:1:30, 0:1:30);
kdot = k.^alpha-c-(n+g+delta).*k;
cdot = (1/theta).*(alpha.*(k^(alpha-1))-delta-rho-theta.*g).*c;
quiver(k,c, kdot, cdot, 1), axis tight
xlabel 'x', ylabel 'y'
title 'Ramsey Model'
  2 comentarios
Mathieu NOE
Mathieu NOE el 18 de Mayo de 2022
see what you get with
quiver(k,c,kdot,cdot,0)
does it makes sense ?
econogist
econogist el 18 de Mayo de 2022
Attached is what it spits out. It doesn't make sense. Just a blank plot.

Iniciar sesión para comentar.

Respuesta aceptada

David Goodmanson
David Goodmanson el 18 de Mayo de 2022
HI ec,
There are a couple of issues here. First, the cdot expression lacks a dot, should be
k.^(alpha-1).
Second, the grid for k begins at zero, so
0^(alpha-1) = inf
which you don't want. Then you have to adjust the grid to find the fixed point for the given parameters. In the code below, quiver also multiplies the arrows by 3 to make them more visible.
clc
clear all
alpha=0.5;
rho=0.8;
delta=0.3;
n=1;
g=1;
theta=1;
[k, c] = meshgrid(.01:.01:.15, .01:.01:.25);
kdot = k.^alpha-c-(n+g+delta)*k;
cdot = (1/theta)*(alpha*(k.^(alpha-1))-delta-rho-theta*g).*c;
quiver(k,c, kdot, cdot,3), axis tight
xlabel 'x', ylabel 'y'
title 'Ramsey Model'
  1 comentario
econogist
econogist el 18 de Mayo de 2022
Ah, thank you!!! I should have caught that.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Vector Fields en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by