How to interpolate these values?

Hi everyone. I have a table like this:
Well, I have to calculate for example the value for (ALFA = 14,2-CD=150) that there isn't in this table. I tried to calculate the equation in Excel with polynomial regression and also with INTERP in Matlab but it isn't accurate. I don't know where I am wrong. Can you help me? Thanks a lot.

3 件のコメント

Matt J
Matt J 2013 年 1 月 25 日
By the way, commas for decimals, e.g., ALFA = 14,2 are very prone to confusion in MATLAB forums since commas are used in MATLAB for other things.
Jan
Jan 2013 年 1 月 25 日
Please show us, how you use INTERP. Otherwise we cannot guess what's going wrong.
Giacomo
Giacomo 2013 年 1 月 25 日
I know. I'm sorry..

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

回答 (3 件)

Matt J
Matt J 2013 年 1 月 25 日

0 投票

You should use INTERP2 or griddedInterpolant.

2 件のコメント

Giacomo
Giacomo 2013 年 1 月 25 日
Ok, let's try.
Matt J
Matt J 2013 年 1 月 25 日
編集済み: Matt J 2013 年 1 月 25 日
Glad it worked. You may not be aware of the practice of Accepting answers. Please accept this one if it was what you needed.

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

Giacomo
Giacomo 2013 年 1 月 25 日
編集済み: Giacomo 2013 年 1 月 25 日

0 投票

Ok, I wrote:
load cl.txt
alfa=cl(2:61,1);
Reynolds=cl(1,2:8);
values=cl(2:61,2:8);
And if I ask
CL(150,14.2)= interp2(Reynolds,alfa,values,150,14.2)
it returns the right value. The new problem is that I have two matrices 17x11, Alpha and Re. Now, I have to calculate CL matrix (17x11) where (i,j) elements are calculated combined the (i,j) values of Alpha and Re through INTERP2 command.
Suggestions?
Giacomo
Giacomo 2013 年 1 月 25 日

0 投票

I tried with:
for i=1:length(r)
for j=1:n+1
CL(i,j) = interp2(Reynolds,alfa,values,Re(i,j),alpha(i,j));
end
end
and seems work.
Thank you, Matt.

1 件のコメント

Matt J
Matt J 2013 年 1 月 25 日
You could also have done it with a single call to INTERP2 (which is faster) by doing
idx=sub2ind(size(Re),1:length(r),1:n+1);
CL(idx) = interp2(Reynolds,alfa,values,Re(idx),alpha(idx));

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

カテゴリ

ヘルプ センター および File ExchangeInterpolation についてさらに検索

質問済み:

2013 年 1 月 25 日

Community Treasure Hunt

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

Start Hunting!

Translated by