Find values of two variables corresponding to query points of two matrices.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
If Ithere are 2 equations A(x,y) and B(x,y) that are functions of 2 varibles x, y. Suppose I set some values for x and y as vectors with lenghts i and k, respectively. Then I calclauted the matrices A (ixk) and B(ixk) corresponding to x, and y vectors.
How can I determine x, and y values for which A(x,y) and B(x,y) equal certain values (say v1 and v2) that are not in the calculaetd matrices?!
I think I should use "interpolation" but I don't know how I can apply it for this case.
0 Kommentare
Antworten (1)
Matt J
am 7 Jun. 2023
Bearbeitet: Matt J
am 7 Jun. 2023
You should use fsolve or fminsearch to solve the original equations. Both of these are iterative solvers requiring an initial guess (x0,y0) of the solution.The matrices A and B can be used to do a discrete search for an approximate solution, which can serve as your (x0,y0):
[~,jmin]=min(hypot(A-v1,B-v2),[],'all','linear');
[x0,y0]=ind2sub([i,k], jmin);
x0=xvector(x0); y0=yvector(y0); %initial guess
0 Kommentare
Siehe auch
Kategorien
Mehr zu Interpolation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!