How can I use interp2 or interp3 for data without using MESHGRID or NGRID previously?

조회 수: 15 (최근 30일)
I have coordinates X, Y, Z each of one is a Matrix of 67 x 147. Each Matrix was no generated by MESHGRID or NGRID method but just were adjusted by means reshape() to be visualize with surf(). However when I try to use interp2() to get a value that I need. There is a error that indicates that data were not generated with meshgrid(). How can I convert the data to interpolate?.
Best Regards
Diego F.

답변 (1개)

Walter Roberson
Walter Roberson 2013년 5월 30일
Interpolation for 2-D gridded data in meshgrid format
ZI = interp2(X,Y,Z,XI,YI) returns matrix ZI containing elements corresponding to the elements of XI and YI and determined by interpolation within the two-dimensional function specified by matrices X, Y, and Z. X and Y must be monotonic, and have the same format ("plaid") as if they were produced by meshgrid.
Are your X and Y matrices monotonic and "plaid" ? So one of them goes like
1 2 3
1 2 3
1 2 3
and the the other one goes like
4 4 4
5 5 5
6 6 6
?
  댓글 수: 2
Diego Flores
Diego Flores 2013년 5월 30일
Hi Walter, thanks for the answer.
The Matrices are monotonic but they are not "plaid".
X=0.1216967163 0.1216976461 0.1216987718 ... ...
0.1217044517 0.1217053814 0.1217065067 ... ...
0.1217115548 0.1217124842 0.1217136092 ... ...
... ... ...
... ... ...
Y=0.00358609375 0.00358599648 0.003585879951 ... ...
0.003313193137 0.00331309534 0.00331297815 ... ...
0.003041094743 0.00304099621 0.003040878105 ... ...
.... .... ....
.... .... ....
I think the "plaid" matrices just work for simple examples, but in real problems the matrices are not "plaid" and interpolation methods available in MATLAB fail.
I hope there is a solution
Thanks in advance
Diego

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

카테고리

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