Why do I get an invalid dimensions error using TriScatteredInterp?

18 ビュー (過去 30 日間)
mythili
mythili 2011 年 2 月 1 日
I'm using TriScatteredInterp for 3 dimensional interpolation.
I have 3 variables xd,yd,zd of size 151:3 and I want to interpolate the values of z of size 31:25 for the given input values of x and y size 31:25.
If i run this program:
xd1=xlsread('3dcr.xls',1);
xd2=xlsread('3dcr.xls',7);
xd3=xlsread('3dcr.xls',3);
xd=[xd1,xd2,xd3];
yd1=xlsread('3dcr.xls',5);
yd2=xlsread('3dcr.xls',9);
yd3=xlsread('3dcr.xls',6);
yd=[yd1,yd2,yd3];
zd1=xlsread('3dcr.xls',2);
zd2=xlsread('3dcr.xls',8);
zd3=xlsread('3dcr.xls',4);
zd=[zd1,zd2,zd3];
f=TriScatteredInterp(xd,yd,zd);
for i=1:31
for j=1:25
v(i,j)=20;
b(i,j)=0.9;
end
end
zz=f(v,b)
I get this error:
??? Error using ==> TriScatteredInterp
Input data point locations have invalid dimension.
Error in ==> Untitled at 13
f=TriScatteredInterp(xd,yd,zd);
  2 件のコメント
Jiro Doke
Jiro Doke 2011 年 2 月 1 日
What are the sizes of xd, yd, zd? The documentation says they have to be column vectors of the same size.
mythili
mythili 2011 年 2 月 1 日
thank u Jiro...its working with column vectors...

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

採用された回答

Oleg Komarov
Oleg Komarov 2011 年 2 月 1 日
As Jiro pointed out xd, yd, zd should be column vectors. Whereas you're doing:
xd=[xd1,xd2,xd3];
yd=[yd1,yd2,yd3];
zd=[zd1,zd2,zd3];
Try to use:
f=TriScatteredInterp(xd(:),yd(:),zd(:))
Then it's not clear what the loop after is for...
Oleg
  1 件のコメント
mythili
mythili 2011 年 2 月 1 日
thank u Oleg..
as u said, with column vectors its working...

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import from MATLAB についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by