2D Interpolation with different sized matrices

조회 수: 1 (최근 30일)
Senal Perera
Senal Perera 2021년 1월 18일
댓글: Senal Perera 2021년 1월 20일
x = [1 2 3 4 5];
y = [1 2 3 4 5];
z = [1 2 1 2 3; 3 4 3 4 5; 5 6 5 6 7; 3 4 3 4 5; 1 2 1 2 3];
]
Hello,
Is there a method to obtain the corresponding x value when the y and z values are provided? I tried interp2 which gives the value of z when x and y are given. The command does not offer me the expected option. Can somebody guide me to solve my problem?
Thanks in advance.
  댓글 수: 1
Jan
Jan 2021년 1월 18일
Please provide an example of the inputs and the wanted output.

댓글을 달려면 로그인하십시오.

답변 (1개)

Jan
Jan 2021년 1월 18일
A bold guess of what "corresponding x value when the y and z values are provided" means:
x = [1 2 3 4 5];
y = [1 2 3 4 5];
z = [1 2 1 2 3; 3 4 3 4 5; 5 6 5 6 7; 3 4 3 4 5; 1 2 1 2 3];
yWant = 2;
zWant = 3;
match = (y == yWant) & (z == zWant); % Auto-expand, Matlab >= R2016b
xResult = x(any(match, 1));
  댓글 수: 3
Jan
Jan 2021년 1월 19일
My code does only find exact matchs, so it is not an interpolation. Therefore I asked for examples of inputs and the wanted outputs. Please answer this question for clarification, because it is required to understand, what you want to get. I cannot guess, what you want as output for the inputs y=2.5 and z=4.5 .
Senal Perera
Senal Perera 2021년 1월 20일
sorry for the inconvenience. I need to get the value of x as the output. The two inputs will be y=2.5 and z=4.5

댓글을 달려면 로그인하십시오.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by