[Top][All Lists]

[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)


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

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

It's the index after k that bothers me.

View this message in context:
Sent from the Octave - General mailing list archive at

reply via email to

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