Solving over determined algebraic system in MATALB
3 次查看(过去 30 天)
显示 更早的评论
Hi I am trying to solve over determined system which is algebraic. Below is the over determined system explained.
u=linspace(0,2,30)
for i=1:30
v(i,:)=2+tan(u(i)/(1+u(i).^2))
end
f=((a-b+c+d)*(a-b-c+d)*(u^2)*(v^2))+((a+b-c+d)*(a+b+c+d)*(u^2))+((a+b-c-d)*(a+b-c-d)*(a+b+c-d)*(v^2))-(8*a*b*u*v)+((a-b+c-d)*(a-b-c-d))
there are 30 values of u and 30 values of v but how I will be able to find a,b and c if we put d as 1
5 个评论
采纳的回答
Walter Roberson
2018-4-14
%it is important that the independent variable, u, be last for curvefit purposes
fun = @(a,b,c,u) u.^2*(a + b + c + 1).*(a + b - c + 1) - (a - b + c - 1).*(b - a + c + 1) + (tan(u./(u.^2 + 1)) + 2).^2.*(a + b + c - 1).*(a + b - c - 1).^2 - 8.*a.*b.*u.*(tan(u./(u.^2 + 1)) + 2) + u.^2.*(tan(u./(u.^2 + 1)) + 2).^2.*(a - b - c + 1).*(a - b + c + 1);
fitobj = fittype(fun, 'independent', 'u');
u = linspace(0,2,30);
results = fit(u(:), known_f(:), fitobj)
I did not have any known f values to work with, so I used rand(). The coefficients I got back passed through 0, which typically indicates that you cannot trust the results at all. But you could potentially get better results with your actual known f values.
5 个评论
Walter Roberson
2018-4-15
Curvefit uses nonlinear least squares when it is handed a function handle, as is the case we constructed here.
Walter Roberson
2018-4-15
Note, though, that fit() (as above) expects the function to return a predicted value, and fit() itself subtracts off the actual value and constructs sum of squares of those. But lsqnonlin expects instead that the function already have subtracted off the actual value (but expects a vector output and it will calculate the sum of squares of those.)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Mathematics and Optimization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!