WICHTIG: Der Betrieb von goMatlab.de wird privat finanziert fortgesetzt. - Mehr Infos...

Mein MATLAB Forum - goMatlab.de

Mein MATLAB Forum

 
Gast > Registrieren       Autologin?   

Partner:




Forum
      Option
[Erweitert]
  • Diese Seite per Mail weiterempfehlen
     


Gehe zu:  
Neues Thema eröffnen Neue Antwort erstellen

Solow-Modell: Deterministisches Modell modellieren

 

faronkis
Forum-Newbie

Forum-Newbie


Beiträge: 6
Anmeldedatum: 28.11.20
Wohnort: ---
Version: ---
     Beitrag Verfasst am: 28.11.2020, 10:53     Titel: Solow-Modell: Deterministisches Modell modellieren
  Antworten mit Zitat      
Hat jemand schon mal ein deterministisches Model, speziell hier - das Solow Modell implementiert? Ich habe mal die Aufgabe als Datei (Solow Modell) hochgeladen. ANbei meine bisherige Versuche das Modell zu modellieren.


function [kdot] = solowkdot(n,g,s,delta,k)

n=0.0; % population growth
g=0.01; % economic (production) growth
s=0.36; % savings rate
delta=0.075; % depreciation rate
k=5;
kdot = s*y-(delta+g+n)*k;

end

function [kss] = solowkss(s,delta,n,g,alpha)

alpha=0.36; % output elasticity of capital/capital income share
n=0.0; % population growth
g=0.01; % economic (production) growth
s=0.36; % savings rate
delta=0.075; % depreciation rate

% Detailed explanation goes here

kss = (s./(delta+g+n))^(1./(1-alpha));

end

%Normalize all variables to efficiency-units x(t)= X(t)/A(t)*L(t)

y=k.^alpha;
kdot= s*y-(delta+g+n)*k;
L=(1+n); % population growth
A=(1+g); % technological growth

%% solves for the steady-state capital stock in the Solow Model
% parametrize the model parameters
alpha=0.36; % output elasticity of capital/capital income share
n=0.0; % population growth
g=0.01; % economic (production) growth
s=0.36; % savings rate
delta=0.075; % depreciation rate

% solve for the root of kdot
k0 = 5; % inital guess
options = optimset('disp','iter'); % display iterations
kss = fsolve(kdot,k0,options);

% Steady state (variables per unit of effective labor
kss=(s/(delta+g+n))^(1/(1-alpha)); % stock of physical capital
yss=(kss^alpha); % output
css=(1-s)*yss; % cosumption
iss=s*yss; % investment


%Chebyshev nodes
syms k
chebyshevT([0, 1, 2, 3, 4], kdot)

syms k y
fplot(chebyshevT(0:4,kdot))
axis([-1.5 1.5 -2 2])
grid on

ylabel('T_n(k)')
legend('T_0(k)','T_1(k)','T_2(k)','T_3(k)','T_4(k)','Location','Best')
title('Chebyshev polynomials of the first kind')

Ich freue mich über jeden Ratschlag.

Grüße

Faronkis

solowkdot.m
 Beschreibung:

Download
 Dateiname:  solowkdot.m
 Dateigröße:  243 Bytes
 Heruntergeladen:  151 mal
solowkss.m
 Beschreibung:

Download
 Dateiname:  solowkss.m
 Dateigröße:  360 Bytes
 Heruntergeladen:  147 mal
ass1.m
 Beschreibung:

Download
 Dateiname:  ass1.m
 Dateigröße:  1.18 KB
 Heruntergeladen:  140 mal
Solow MOdel.png
 Beschreibung:

Download
 Dateiname:  Solow MOdel.png
 Dateigröße:  198.62 KB
 Heruntergeladen:  132 mal
Private Nachricht senden Benutzer-Profile anzeigen


Harald
Forum-Meister

Forum-Meister


Beiträge: 24.448
Anmeldedatum: 26.03.09
Wohnort: Nähe München
Version: ab 2017b
     Beitrag Verfasst am: 28.11.2020, 11:21     Titel:
  Antworten mit Zitat      
Hallo,

welche Fragen oder Probleme hast du denn zu dem Code?
Bitte beim Posten von Code die Code-Umgebung verwenden.

Grüße,
Harald
_________________

1.) Ask MATLAB Documentation
2.) Search gomatlab.de, google.de or MATLAB Answers
3.) Ask Technical Support of MathWorks
4.) Go mad, your problem is unsolvable ;)
Private Nachricht senden Benutzer-Profile anzeigen
 
faronkis
Themenstarter

Forum-Newbie

Forum-Newbie


Beiträge: 6
Anmeldedatum: 28.11.20
Wohnort: ---
Version: ---
     Beitrag Verfasst am: 28.11.2020, 16:56     Titel:
  Antworten mit Zitat      
Hallo Harald, ich habe mit meiner Rückmeldung noch etwas länger gebraucht, da ich alles nochmal überarbeitet habe.

Ich habe jetzte folgende Funktionen aufgestellt:
Code:
function [y] = solowG(k)
alpha=0.33;     % output elasticity of capital/capital income share
y = k.^alpha;
end
 


Code:
function [kt] = solowP(k)
s=0.36;         % savings rate
delta=0.075;    % depreciation rate
n=0.01;         % population growth
g=0.01;         % economic (production) growth
alpha=0.33;     % output elasticity of capital/capital income share
kt = (s*(k.^alpha))+((1-delta)*k)/((1+n)*(1+g)); % law of motion
end

 

Code:
function [kdot] = solowkdot(k)

n=0.01;          % population growth
g=0.01;         % economic (production) growth
s=0.36;         % savings rate
delta=0.075;    % depreciation rate
alpha=0.33;     % output elasticity of capital/capital income share

kdot = s*(k.^alpha)-(delta+g+n)*k;
 
end
 


Code:
function [h] = solowH(k)
s=0.36;         % savings rate
delta=0.075;    % depreciation rate

alpha=0.33;     % output elasticity of capital/capital income share
h = s*(k.^alpha)-((1-delta)*k);
end
 


Ich möchte nun kss, d.h. k im steady state mit folgender Codirung berechnen:
Code:
% 1) a) Normalize all variables to efficiency-units x(t)= X(t)/A(t)*L(t)

y=k.^alpha;
k(t+1)= (s*y+(1+delta)*k)/((1+n)*(1+g));
L=(1+n);                            % population growth
A=(1+g);                            % technological growth

% 1) b) parametrize the model parameters: The chosen values are selected by an empirical point of view.
alpha=0.36;     % output elasticity of capital/capital income share
n=0.01;          % population growth
g=0.01;         % economic (production) growth
s=0.36;         % savings rate
delta=0.075;    % depreciation rate

% 1) c) for analytical procedure see the word file assg.1_probl.1
kss = (s./(delta+g+n))^(1./(1-alpha));

% Solving for kstar is the same as finding the root (the zero) of h = s*y-((1-delta)*k;

k=5; % inital guess
options = optimset('disp','iter'); % display iterations
kstar= fsolve(k,solowH,options);
 


Es geht leider nicht.
Auch Aufg. d) - f)
d) Pick a set of n equidistant starting values where k0 < kss occurs as often as
k0 > kss. Bonus: use n Chebyshev nodes

e) Use a while-loop to simulate the model. Define a norm and stopping rule so
that iterations stops once kt has converged on the 5th digit. You may introduce an
iteration counter.

f) Plot the paths of convergence

Ich bekomme es leider nicht hin.

Solow MOdel.png
 Beschreibung:

Download
 Dateiname:  Solow MOdel.png
 Dateigröße:  198.62 KB
 Heruntergeladen:  129 mal
Private Nachricht senden Benutzer-Profile anzeigen
 
Harald
Forum-Meister

Forum-Meister


Beiträge: 24.448
Anmeldedatum: 26.03.09
Wohnort: Nähe München
Version: ab 2017b
     Beitrag Verfasst am: 28.11.2020, 17:32     Titel:
  Antworten mit Zitat      
Hallo,

Zitat:
Es geht leider nicht.

Heißt was? Eine Fehlermeldung (welche?) oder unerwartete Ergebnisse (inwiefern)?

Ein Problem, das ich auf Anhieb sehe: du musst die Argumente für fsolve in der richtigen Reihenfolge übergeben.

Grüße,
Harald
_________________

1.) Ask MATLAB Documentation
2.) Search gomatlab.de, google.de or MATLAB Answers
3.) Ask Technical Support of MathWorks
4.) Go mad, your problem is unsolvable ;)
Private Nachricht senden Benutzer-Profile anzeigen
 
faronkis
Themenstarter

Forum-Newbie

Forum-Newbie


Beiträge: 6
Anmeldedatum: 28.11.20
Wohnort: ---
Version: ---
     Beitrag Verfasst am: 28.11.2020, 18:13     Titel:
  Antworten mit Zitat      
Okey. Leider bin ich ein Anfänger, was Matlab angeht.

Wenn ich kstar ausrechnen möchte, versuche ich es mit diesem code

Code:
y = @(k) k.^alpha;
h = @(k) (s*(k.^alpha))-((1-delta)*k);
% solve for the root of h(k)
k0 = 5; % inital guess
options = optimset('display','iter'); % display iterations
kstar = fsolve(h,k0,options);


Fehlermeldung ist dann:
'fsolve' requires Optimization Toolbox.

Hilft das weiter in der Beschreibung des Problems. Ich glaube aber, dass ich eventuell etwas Grundlegendes falsch mache und weiß aber nicht was. Deshalb habe ich auch am ANfang meine Funktionen mitgeschickt, damit man mir sagen kann, ob überhaupt die Modellierung des SOlow-Modells richtig ist..
Private Nachricht senden Benutzer-Profile anzeigen
 
Harald
Forum-Meister

Forum-Meister


Beiträge: 24.448
Anmeldedatum: 26.03.09
Wohnort: Nähe München
Version: ab 2017b
     Beitrag Verfasst am: 28.11.2020, 18:38     Titel:
  Antworten mit Zitat      
Hallo,

die Fehlermeldung ist doch sehr klar. Du versuchst Funktionalität einer Toolbox / Erweiterung zu verwenden, die du nicht lizensiert / installiert hast.

Grüße,
Harald
_________________

1.) Ask MATLAB Documentation
2.) Search gomatlab.de, google.de or MATLAB Answers
3.) Ask Technical Support of MathWorks
4.) Go mad, your problem is unsolvable ;)
Private Nachricht senden Benutzer-Profile anzeigen
 
Neues Thema eröffnen Neue Antwort erstellen



Einstellungen und Berechtigungen
Beiträge der letzten Zeit anzeigen:

Du kannst Beiträge in dieses Forum schreiben.
Du kannst auf Beiträge in diesem Forum antworten.
Du kannst deine Beiträge in diesem Forum nicht bearbeiten.
Du kannst deine Beiträge in diesem Forum nicht löschen.
Du kannst an Umfragen in diesem Forum nicht mitmachen.
Du kannst Dateien in diesem Forum posten
Du kannst Dateien in diesem Forum herunterladen
.





 Impressum  | Nutzungsbedingungen  | Datenschutz | FAQ | goMatlab RSS Button RSS

Hosted by:


Copyright © 2007 - 2024 goMatlab.de | Dies ist keine offizielle Website der Firma The Mathworks

MATLAB, Simulink, Stateflow, Handle Graphics, Real-Time Workshop, SimBiology, SimHydraulics, SimEvents, and xPC TargetBox are registered trademarks and The MathWorks, the L-shaped membrane logo, and Embedded MATLAB are trademarks of The MathWorks, Inc.