Find values of two variables corresponding to query points of two matrices.
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (1개)
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
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!