所以,據我瞭解,這個問題與擬合無關,而是關於如何將圖像放在表面上?
你說「背景」,但我不知道你指的是軸或面,但這應該工作無論哪種方式(除非你需要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
因此,如果您需要幫助,這就是問題所在。顯示該代碼以及它輸出的內容等。 –