[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Using fsolve with time series data
From: |
Terry Duell |
Subject: |
Using fsolve with time series data |
Date: |
Fri, 09 Aug 2013 12:43:19 +1000 |
User-agent: |
Opera Mail/12.16 (Linux) |
Hello All,
I am trying to solve a system of equations that involve time series data.
My system of equations are of the general form...
A1 = A0 - R1*x(3) + R1*x(6) - R1*x(5)*x(5) -R1*x(2)*x(2)
A2 = A0 - R2*x(3) + R2*x(6) - R2*x(5)*x(5) -R2*x(2)*x(2)
etc
where A1, A2...are known vectors (1,N).
R1, R2 etc are known scalars.
A0 is an unknown vector (1,N)
The other unknown variables, x(1), x(2) etc should be vectors (1,N).
I have 8 unknowns and 8 equations.
I have set up a script, where I define the scalars (R1 etc), and my known
vectors, and define my
function in this form...
fcn = @(x) [x(7) - R1*x(3) + R1*x(6) - R1*x(5)*x(5) - R1*x(2)*x(2) - A1,
...
for all the equations
];
% where x(7) = A0,
and call fsolve, thus...
[x, fvec, info] = fsolve(fcn, [0 0 0 0 0 0 0 0]);
This is returning a solution, but the x(i) values that are returned are
scalars. They should be vectors (1,N).
Is it possible to solve a problem of this type, and if so, how should I
reformulate/correct my approach so that the solution returns the x's as
vectors?
Cheers,
--
Regards,
Terry Duell
- Using fsolve with time series data,
Terry Duell <=