Why do I get an invalid dimensions error using TriScatteredInterp?

15 次查看(过去 30 天)
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.

请先登录,再进行评论。

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Import from MATLAB 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by