Bi-cubic interpolation
/*******2019.03.31**********
双三次多项式插值 Bi-cubic interpolation
插值数据大小384*122,网格间距24m*24m
122行,384列
将数据模型插值为网格间距为dx=4m,dz=6m的数据模型。
数据文件名为md.txt
***************************/
#include<cstdio>
//参数及常量定义
const int M=9,N=9; //原始数据大小
const int dX=10,dZ=10,dz=2,dx=2; //原始和插入后的网格间距
const int m=dZ/dz*(M-1)+1,n=dX/dx*(N-1)+1; //插值后网格大小
double indata[M][N]={0.0}; //原始数据
double outdata[m][n]={0.0};
FILE * fpin,*fpout; //两个文件指针,表示输入输出
struct matrix { //定义矩阵结构体
int dx,dy;
double **A;
matrix() {}
matrix (int m ,int n) { //动态申请空间
A=new double *[m];
for(int i=0;i<m;i++) {
A[i]=new double [n];
}
dx=n;
dy=m;
}
};
matrix operator * (const matrix c1,const matrix c2) { //定义矩阵乘法
matrix temp(c1.dy,c2.dx);
d