Why do I get an invalid dimensions error using TriScatteredInterp?
18 views (last 30 days)
Show older comments
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 Comments
Jiro Doke
on 1 Feb 2011
What are the sizes of xd, yd, zd? The documentation says they have to be column vectors of the same size.
Accepted Answer
Oleg Komarov
on 1 Feb 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
More Answers (0)
See Also
Categories
Find more on Data Import from MATLAB in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!