Solving over determined algebraic system in MATALB
1 回表示 (過去 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 日
What are your inputs? Do you have one known f value for each u value?
採用された回答
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 で Linear and Nonlinear Regression についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!