所以,据我了解,这个问题与拟合无关,而是关于如何将图像放在表面上?
你说“背景”,但我不知道你指的是轴或面,但这应该工作无论哪种方式(除非你需要z = 0的一个额外的面为前):
% make dummy test data
N = 60;
X = 1:N;
Y = 1:N;
[X, Y] = meshgrid(X,Y);
Z = X - X.^2 + Y.^2 + randn(N,N)*10;
% read jpg and make same size as grid
im = imread('yourimage.jpg');
% convert image to indexed colours
[im, map] = rgb2ind(im, 256);
% make figure
figure(1), clf
% make image same size as grid
subimage = im(1:N,1:N);
colormap(map)
% plot surf and use image as texture
s = surf(X,Y,Z);
set(s, 'faceColor', 'texture',...
'edgecolor', 'none',...
'cdata', subimage)
这是你的意思吗?
你将永远得到whathaveyoutried.com –
我最好的建议已经 '[Xout,Yout,ZOUT = prepareSurfaceData(X,Y,V); [c,goft] = fit([XOut,YOut],ZOut,'poly02'); 情节(c)' 但我不知道如何将视图变成XY。然后从.jpg文件中添加背景 – user1877600
因此,如果您需要帮助,这就是问题所在。显示该代码以及它输出的内容等。 –