Multiplying Basis Sets by Eigenfunctions

Rosen Diankov rdiankov at cs.cmu.edu
Sun Oct 5 14:08:42 CDT 2008


you can do this in two ways:

- symbols
declare x as a symbol, then your basis vectors also becomes a matrix of
symbols. The problem here is that octave's symbolic toolbox doesn't like
matrices of symbols (matlab can do this)

- function pointers
you can do something like:
BasisSet =@(x)
[sin(-5.*x),sin(-4.*x),sin(-3.*x),sin(-2.*x),sin(-x),sin(0),sin(x),sin(2.*x),sin(3.*x),sin(4.*x),sin(5.*x)];


BasisWithEigVectorSet =  @(x) BasisSet(x) * EVECT

i think you would want x to be a column vector rather than a row vector for
the math to work out

rosen diankov,

2008/10/5 Thomas Markovich <thomasmarkovich at gmail.com>

> Hi,
>
> Currently I have a problem for which, after reading all the literature
> I could find, has no apparently solution.
>
> Basically, I am trying to multiply my basis set of functions by my
> matrix of eigenvectors to give me eigenfunctions.
>
> What this looks like is, lets say that I have a set for n=2, I have a
> row vector of
>
> [e^-2*i*x, e^-ix, e^0, e^ix, e^2ix] and I would need to multiply this
> by a matrix of eigenvectors to give me a column vector of
> eigenfunctions. Unfortunately, all I can come up with is to do this by
> hand. Here is what I have tried in Octave.
> For n = 5, I do
>
> [EVECT,EIG] = eig(a)
> EVECT = (numbers are unimportant, all that matters is that its a 11x11
> matrix)
>
> octave-3.0.2:3> BasisSet =
> [sin(-5.*x),sin(-4.*x),sin(-3.*x),sin(-2.*x),sin(-
> x),sin(0),sin(x),sin(2.*x),sin(3.*x),sin(4.*x),sin(5.*x)]
> error: `x' undefined near line 3 column 21
> error: evaluating binary operator `.*' near line 3, column 19
> error: evaluating argument list element number 1
> error: evaluating assignment expression near line 3, column 10
> octave-3.0.2:3> x = [-pi,pi];
> octave-3.0.2:4> x = [-pi,pi]
> x =
>
>   -3.1416   3.1416
>
> octave-3.0.2:5> BasisSet =
> [sin(-5.*x),sin(-4.*x),sin(-3.*x),sin(-2.*x),sin(-
> x),sin(0),sin(x),sin(2.*x),sin(3.*x),sin(4.*x),sin(5.*x)]
> BasisSet =
>
>  Columns 1 through 11:
>
>    6.1232e-16  -6.1232e-16  -4.8986e-16   4.8986e-16   3.6739e-16
> -3.6739e-16  -2.4493e-16   2.4493e-16   1.2246e-16  -1.2246e-16
> 0.0000e+00
>
>  Columns 12 through 21:
>
>   -1.2246e-16   1.2246e-16   2.4493e-16  -2.4493e-16  -3.6739e-16
> 3.6739e-16   4.8986e-16  -4.8986e-16  -6.1232e-16   6.1232e-16
>
> octave-3.0.2:7> BasisSet * EVECT
> error: operator *: nonconformant arguments (op1 is 1x21, op2 is 11x11)
> error: evaluating binary operator `*' near line 7, column 10
> octave-3.0.2:7> BasisSet .* EVECT
> error: product: nonconformant arguments (op1 is 1x21, op2 is 11x11)
> error: evaluating binary operator `.*' near line 7, column 10
>
>
>  From here, I have no clue where to go. I am honestly not even sure if
> octave can do what I need it to do. Anyways, any help in any fashion
> is much appreciated.
> _______________________________________________
> Help-octave mailing list
> Help-octave at cae.wisc.edu
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www-old.cae.wisc.edu/pipermail/help-octave/attachments/20081005/6647534b/attachment.html 


More information about the Help-octave mailing list