[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## matrix of variables?

**From**: |
jdonner |

**Subject**: |
matrix of variables? |

**Date**: |
Fri, 30 May 2003 17:12:01 -0500 |

**User-agent**: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4b) Gecko/20030513 |

Hi,
I'm trying to solve a non-linear equation with 25 vars,
and it works when I number them from x(1) .. x(25) but,

`they naturally are a 2D array of variables, is there some way
``I can I use matrix notation for convenience?
``
`When I try to say this:
function y = f (x)
g = 0.9;
# center parts
y(2,2) = -1 * x(2,2) + (1/4)*g*(x(1,2) + x(2,1) + x(2,3) + x(3,2));
y(2,3) = -1 * x(2,3) + (1/4)*g*(x(1,3) + x(2,2) + x(2,4) + x(3,3));
... more
I get:
error: invalid column index = 2
error: evaluating binary operator `*' near line 4, column 13
error: evaluating binary operator `+' near line 4, column 22
error: evaluating assignment expression near line 4, column 8
error: called from `f'
error: fsolve: evaluation of user-supplied function failed

`Is there a way to do this?
``
`Thanks,
Jeff
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------

**matrix of variables?**,
*jdonner* **<=**