Solving over determined algebraic system in MATALB

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 件のコメント

Torsten
Torsten 2018 年 4 月 13 日
編集済み: Torsten 2018 年 4 月 13 日
You want to determine a, b and c such that f(i,j)=0 approximately for all given pairs (u(i),v(j)) ?
Abdullah Nasir
Abdullah Nasir 2018 年 4 月 13 日
編集済み: Abdullah Nasir 2018 年 4 月 14 日
Yes exactly I need to determine a, b and c such that f(i,j)=0 approximately for all given pairs (u(i),v(j))
Thank you
Walter Roberson
Walter Roberson 2018 年 4 月 14 日
Do you have the curve fitting toolbox?
Abdullah Nasir
Abdullah Nasir 2018 年 4 月 14 日
Yes I have the curve fitting toolbox but I have never used it
Thank you
Walter Roberson
Walter Roberson 2018 年 4 月 14 日
What are your inputs? Do you have one known f value for each u value?

サインインしてコメントする。

 採用された回答

Walter Roberson
Walter Roberson 2018 年 4 月 14 日

0 投票

%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 件のコメント

Abdullah Nasir
Abdullah Nasir 2018 年 4 月 14 日
Hi Sorry I need to determine a, b and c such that f(i,j)=0 approximately for all given pairs (u(i),v(j)). (f) it the function.
Thank you
Walter Roberson
Walter Roberson 2018 年 4 月 14 日
Ah, in that case use known_f = zeros(size(u));
results =
General model:
results(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)
Coefficients (with 95% confidence bounds):
a = -0.3037 (-0.3283, -0.2791)
b = 0.4132 (0.4004, 0.4261)
c = 0.6249 (0.6205, 0.6294)
Your v values are not givens: they are calculated from your u values in your loop at the beginning.
Abdullah Nasir
Abdullah Nasir 2018 年 4 月 15 日
By the way is there any other way to solve this type of problem without using the curve fitting tools. This problem states as non-linear least square problem.
Thank you
Walter Roberson
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
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 件)

カテゴリ

ヘルプ センター および File ExchangeInterpolation of 2-D Selections in 3-D Grids についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by