Find values of two variables corresponding to query points of two matrices.

1 visualizzazione (ultimi 30 giorni)
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.

Risposte (1)

Matt J
Matt J il 7 Giu 2023
Modificato: Matt J il 7 Giu 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

Categorie

Scopri di più su Function Creation in Help Center e File Exchange

Prodotti


Release

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by