| Author |
Comment/Response |
joon
|
08/04/12 01:23am
Hi,
I am trying to fit a 1-dimensional data with eigenvectors. Here is my test code to see if this is possible.
f[a0_, b0_] := Module[{M, eigv},
M = {{a0, 0, 3}, {0, b0, 0}, {3, 0, 7}};
eigv = Eigenvectors[N[M]];
Return[Flatten[eigv]]
]
This function returns a 1-dimensional list. I generate a dataset by using this function for convenience:
data = f[2, 5]
Then I get the data:
{0.424155, 0., 0.905589, 0., -1., 0., -0.905589, 0., 0.424155}
Now I try to fit the data using following expression:
testfit = FindFit[data, f[a, b][[x]], {{a, 3.1}, {b, 5.3}}, x]
I get following warnings and a result:
Part::pspec: Part specification x is neither an integer nor a list of integers. >>
Part::pspec: Part specification #10 is neither an integer nor a list of integers. >>
{a -> 7.57549, b -> 5.3}
The goal was to fit the one dimensional vector with an one dimensional vector generated by f[a,b][[x]]. In this process we compare each element of those two 1-dim lists.
Apparently the result is far from being correct, and I get warnings. Is this idea possible to implement in Mathematica at all?
Thanks!
URL: , |
|