フィルターのクリア

Problem of Interpolation in matlab

3 ビュー (過去 30 日間)
addou abdeljalil
addou abdeljalil 2015 年 7 月 9 日
回答済み: addou abdeljalil 2015 年 7 月 9 日
Hi, My problem are like this: i have a 2 colons of 178 values define UM (Unity Monitor) and angles and i wish to compare one other angle extracted from image dicom to this angle in order to find UM corresponding. i tried interpolation but it doesn't work
% code
UM angle
0 0.5000
1.4700 1.2300
4.3700 3.2800
7.2900 5.2800
for example, if i have angle = 4° what is value of UM corresponding ?
Any help will be appreciate

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2015 年 7 月 9 日
編集済み: Azzi Abdelmalek 2015 年 7 月 9 日
A=[0 0.5000
1.4700 1.2300
4.3700 3.2800
7.2900 5.2800]
UM=A(:,1)
angle=A(:,2)
UMi=4
anglei=interp1(UM,angle,UMi)
  1 件のコメント
addou abdeljalil
addou abdeljalil 2015 年 7 月 9 日
編集済み: Azzi Abdelmalek 2015 年 7 月 9 日
Thank you Azzi for your answer. your answer works well for 4 but when I test other larger values it recturn me not correct values. in fact I have two columns that are each 178 lines so when test for example angle = 182° it return me UM = 287 but the reel value is 126.11.

サインインしてコメントする。

その他の回答 (1 件)

addou abdeljalil
addou abdeljalil 2015 年 7 月 9 日
I tested this code but there also some pb.
for i = 1:178
if A(i,2)< angle < A(i+1,2)
UM = interp1(A(i,1),A(i+1,1),angle)
end
end
it return me this error : Error using interp1 (line 182)
There should be at least two data points.

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by