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

조회 수: 1 (최근 30일)
Islam Elnady
Islam Elnady 2023년 6월 7일
편집: Matt J 2023년 6월 7일
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.

답변 (1개)

Matt J
Matt J 2023년 6월 7일
편집: Matt J 2023년 6월 7일
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

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by