现有i01~i15 十五组1024×1280的矩阵
x为1×15的矩阵;
i01到i15每一个对应的点组成新的矩阵然后与x一次线性拟合,如此该得到1024×1280个线性拟合结果,我想把它先保存起来,后面插值的时候要用的拟合的函数
i16同样为1024×1280的矩阵,它每个点的值对应之前的每个拟合过的函数(也就是calibration curve )可求得每个点的y值;
程序如下:
x=[0.2,8,17.8,25.1,32.3,46.5,50.2,54.5,58.1,62.2,66.3,70.2,75.2,80.3,82.7];
fp=cell(1024,1280);
for i=1:1024
for j=1:1280
y=[i01(i,j),i02(i,j),i03(i,j),i04(i,j),i05(i,j),i06(i,j),i07(i,j),i08(i,j),i09(i,j),i10(i,j),i11(i,j),i12(i,j),i13(i,j),i14(i,j),i15(i,j)];
fp{i,j}=polyfit(x,y,1); %这样每一个fp的细胞元中,都存有k和b
end
end
i16n=polyval(fp,i16);% 其中,i16为1024×1280的矩阵
figure
imagesc(i16n)程序出错,希望高手指点下
??? Error using ==> polyval at 50
P must be a vector.
cell中的该如何调出来用呢
|