my matrix is not square, although i think it is?
4 次查看(过去 30 天)
显示 更早的评论
I have set the following least squares method up quickly. I know i am using a nonlinear technique to solve a linear problem, however i just wanted to get it working, before i choose a linear method but aparently my matrices are not square:
i = [1 2 3 4 5];
ti = [2 5 7 11 14];
Estimates3=fminsearch(@functionnumbers,1,options,T0,theta_f);
and the function code
function fnumbers = functionnumbers(params3,i,ti)
k = params3;
v0 = 1 + (k/2)*ti(1)^2/ti(1)
fnumbers = sum(ti.^2*(i/ti-(v0-(k/2)*ti))^2);
cheers
3 个评论
采纳的回答
Walter Roberson
2011-8-8
fminsearch() accepts at most 3 inputs, and the function passed to it must accept a single input. See http://www.mathworks.com/help/techdoc/ref/fminsearch.html
5 个评论
Walter Roberson
2011-8-9
Are you truly wanting to do a _matrix division_ between i and ti ?? If not then you should be using ./ instead of /
Are you truly wanting to do a matrix multiplication between ti.^2 and the rest of the expression? If not, then you should be using .* instead of *
更多回答(1 个)
Alex
2011-8-9
2 个评论
Walter Roberson
2011-8-9
In the original equation you had "i" divided by "ti", but in the new equations that division appears to have vanished. It does not appear to me that your old and new equations are equivalent, but it could be that I missed something.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Particle & Nuclear Physics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!