Effacer les filtres
Effacer les filtres

Solving over determined algebraic system in MATALB

1 vue (au cours des 30 derniers jours)
Abdullah Nasir
Abdullah Nasir le 13 Avr 2018
Commenté : Walter Roberson le 15 Avr 2018
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 commentaires
Abdullah Nasir
Abdullah Nasir le 14 Avr 2018
Yes I have the curve fitting toolbox but I have never used it
Thank you
Walter Roberson
Walter Roberson le 14 Avr 2018
What are your inputs? Do you have one known f value for each u value?

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 14 Avr 2018
%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 commentaires
Walter Roberson
Walter Roberson le 15 Avr 2018
Curvefit uses nonlinear least squares when it is handed a function handle, as is the case we constructed here.
Walter Roberson
Walter Roberson le 15 Avr 2018
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.)

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by