|
楼主 |
发表于 2008-10-9 20:56
|
显示全部楼层
新的数据格式是:dat
完整的错误提示是:
??? Error using ==> interp2 at 155
X and Y must be matrices produced by MESHGRID. Use GRIDDATA instead
of INTERP2 for scattered data.
Error in ==> test at 140
Z1=interp2(X,Y,Z,X1,Y1);
下面是程序:
clc
clear
%***********************************************************
nx=201;
ny=49;
in=fopen('C:\test\X.dat','r');
z=fread(in,'float32');
fclose(in);
X=reshape(z,ny,nx);
in=fopen('C:\test\Y.dat','r');
z=fread(in,'float32');
fclose(in);
Y=reshape(z,ny,nx);
in=fopen('C:\test\Z.dat','r');
z=fread(in,'float32');
fclose(in);
Z=reshape(z,ny,nx);
%***************************************
nx=51;
ny=44;
in=fopen('C:\test\X1.dat','r');
z=fread(in,'float32');
fclose(in);
X1=reshape(z,ny,nx);
in=fopen('C:\test\Y1.dat','r');
z=fread(in,'float32');
fclose(in);
Y1=reshape(z,ny,nx);
%***********************************************************
Z1=interp2(X,Y,Z,X1,Y1);
for i=1:201
plot(X(:,i),Y(:,i),'.');
hold on
end
for i=1:length(X1)
plot(X1(:,i),Y1(:,i),'r.');
hold on
end
感谢版主提醒
等待高人指点 |
|