How do I Interpolate on an array

조회 수: 11 (최근 30일)
Maarten
Maarten 2013년 11월 13일
댓글: Maarten 2013년 11월 13일
For the analysis of quite a large amount of data, I want to measure the distance between 2 pixels on DICOM image, with the same HU-values, to get the length of an object. Currently I'm doing this manually in Excel with linear interpolation, but it's too much work.
A line plot over the object gives me this curve for example:
What I'm looking for is the two X-coordinates, or the distance between the two, where Y = -350.
I've tried to interpolate with interp1(X,Y,-350), but that just results in a error every time ==> The values of X should be distinct.
How can I do this with Matlab?

채택된 답변

G A
G A 2013년 11월 13일
X1=X(Y>=-350);
distance=X1(end)-X1(1);
if precision is not good enough you can interpolate the curve before this
  댓글 수: 1
Maarten
Maarten 2013년 11월 13일
Your solution works great. Looks like I was using the interp1 function in the wrong way.
Thanks a lot G A.

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

추가 답변 (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