How to interpolate/grid logical data?

조회 수: 7 (최근 30일)
Laura
Laura 2012년 10월 13일
Hello All,
I did not find answers for my question, so I post it here:
I have a matrix of logical gridded data (0 or 1), how could I interpolate them to finer scale gridded data?
E.g., originally, it is X=[1:3:22];Y=[1:3:10]; DATA=[0 0 0 0; 0 0 0 0; 0 1 1 0; 0 1 1 0; 0 1 1 0; 0 1 1 0; 0 0 0 0; 0 0 0 0]; Now I want to interpolate DATA to a new data (also a logical matrix), with X=[1:22];Y=[1:10];
Since I use these data to describe the shape of something. If I use interp2 or griddata, the shape of the matrix will be distorted. I could, of course, write a for loop to check point by point. But I really wish there is another elegant way to deal with this simple problem!!!
Thanks a lot,
Laura
  댓글 수: 1
Matt J
Matt J 2012년 10월 13일
Clarify what you mean by "If I use interp2 or griddata, the shape of the matrix will be distorted."
If you do interp2(DATA,(1:22),(1:10).') then the resulting matrix will be 10x22. In what way is this a distorted shape? What is the shape that you do want?

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

답변 (0개)

카테고리

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