필터 지우기
필터 지우기

How can I get X value by transforming the griddedInterpolant function?

조회 수: 4 (최근 30일)
형준 김
형준 김 2023년 11월 30일
댓글: 형준 김 2023년 12월 1일
Hi.
I have 2D data (60*60) of X, Y, Z, and I've made 'griddedInterpolant' function with these data.
Here is my sample code:
[Xq, Yq] = meshgrid(min(X):(max(X) - min(X))/999:max(X), min(Y):(max(Y) - min(Y))/999:max(Y));
Vq = griddata(X, Y, Z, Xq, Yq, 'linear');
F = griddedInterpolant(Xq', Yq', Vq');
With this F function, I can get Z value of X, Y values.
Z_value = F(X_value, Y_value);
But the thing that I want is X value of Y, Z values with G.
X_value = G(Y_value, Z_value);
I've already tried this link's answer, but couldn't figure out the solution.
Thanks in advance for any help.
  댓글 수: 2
Dyuman Joshi
Dyuman Joshi 2023년 11월 30일
Why not follow the steps you did with F to get Z as F(X, Y)?
형준 김
형준 김 2023년 12월 1일
Sorry for late comment.
Actually, I've tried it. The data shape is as follows:
The code example that I've tried is:
[Yq, Zq] = meshgrid(min(Y):(max(Y) - min(Y))/999:max(Y), min(Z):(max(Z) - min(Z))/999:max(Z));
Xq = griddata(Y, Z, X, Yq, Zq, 'linear');
F = griddedInterpolant(Yq', Zq', Xq');
However, Yq and Zq were empty because of Z.
I didn't write it in the question, X and Y data are gridded data, generated horizontally/vertically. And Z was generated diagonally. So an error occurs in the process of generating Yq and Zq using Z.
That's why I want to transform the function. Sorry for the confusion.

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

채택된 답변

Matt J
Matt J 2023년 12월 1일
편집: Matt J 2023년 12월 1일
Why not just,
F=scatteredInterpolant(Y(:),Z(:),X(:));
  댓글 수: 1
형준 김
형준 김 2023년 12월 1일
OMG.. It works well.
I didn't know it would be solved so easily... Thanks for your help :)

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by