help-octave
[Top][All Lists]
Advanced

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

Function matrix/vector assembly


From: Grant Stephens
Subject: Function matrix/vector assembly
Date: Thu, 9 Aug 2012 06:48:29 +0200

Good Morning

I am trying to assemble a function into a matrix or a vector but I have not found a way to do so except for typing it out manually, which is not possible as the it would be around 100 long and wide and changes after every timestep. The following represents what I am trying to do:

f=@(x) [x^2 x 1]
then I want to put a number of these into a vector so that the final vector would look like:
vect=@(x) [x^2 x+x^2 1+x 1]
Here I have added have done something like:
vect=@(x) [f(x)(1) f(x)(2)+f(x)(1) f(x)(3)+f(x)(2) +f(x)(3)]
So basically having a vector with f in 1 to 3 added to f in positions 2 to 4. Obviously this would have to run in a loop as it is well over 100 wide.
Does anybody have any ideas? Am I missing something simple?

Thank you.


reply via email to

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