help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Saving fsolve vector results in a for loop


From: DGati
Subject: Saving fsolve vector results in a for loop
Date: Thu, 30 Jun 2011 00:52:16 -0700 (PDT)

Hello,

I'm using fsolve to generate solutions for an economic model. The
equilibrium of the model gives me a (2,1) vector k, which is dependent on
many exogenous parameters, including a tau. With a given tau, k is given by

k = fsolve(@(k) dcap(k, param), guess)

where dcap is the function and param is a vector of parameters, including
tau.

Now say tau = linspace(0,0.5, n);
then k  is a (2,n) matrix, with each column being the vector of the
respective equilibrium.

How should I syntax fsolve so that this matrix is saved?

The code I've used so far is

k = zeros (2,n);
tau = linspace(0,0.5, n); 

for i = 1:n
k(i) = fsolve(@(k) dcap(k, param), guess) %the other parameters in param
have the same dimension as tau
endfor

It's the index after k that bothers me.
Thanks!

--
View this message in context: 
http://octave.1599824.n4.nabble.com/Saving-fsolve-vector-results-in-a-for-loop-tp3635036p3635036.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]