Why do I get an invalid dimensions error using TriScatteredInterp?

18 visualizaciones (últimos 30 días)
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 comentarios
Jiro Doke
Jiro Doke el 1 de Feb. de 2011
What are the sizes of xd, yd, zd? The documentation says they have to be column vectors of the same size.
mythili
mythili el 1 de Feb. de 2011
thank u Jiro...its working with column vectors...

Iniciar sesión para comentar.

Respuesta aceptada

Oleg Komarov
Oleg Komarov el 1 de Feb. de 2011
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

Más respuestas (0)

Categorías

Más información sobre Data Import from MATLAB en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by