Solving over determined algebraic system in MATALB
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Abdullah Nasir
il 13 Apr 2018
Commentato: Walter Roberson
il 15 Apr 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 Commenti
Walter Roberson
il 14 Apr 2018
What are your inputs? Do you have one known f value for each u value?
Risposta accettata
Walter Roberson
il 14 Apr 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 Commenti
Walter Roberson
il 15 Apr 2018
Curvefit uses nonlinear least squares when it is handed a function handle, as is the case we constructed here.
Walter Roberson
il 15 Apr 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.)
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!