clear
clc
A = [ --- spherical coordinates (theta, phi, r) [too long] --- ]; % size(A) is 1369 X 3
B = zeros(1369,3);
B(:,1) = A(:,3).*sind(A(:,1)).*cosd(A(:,2));
B(:,2) = A(:,3).*sind(A(:,1)).*sind(A(:,2));
B(:,3) = A(:,3).*cosd(A(:,1)); % converted to cartesian coordinates
raw_x = (B(:, 1))';
raw_y = (B(:, 2));
raw_z = (B(:, 3));
[X, Y] = meshgrid(raw_x, raw_y); % to use interp2
inter_z = vec2mat((raw_z)', 37);
Z = (inter_z)';
上面我试图插值并绘制一组球坐标。对于插值,我需要使用下面的命令
interp2(X,Y,Z,xi,yi,'bicubic') % xi and yi will be defined arbitrarily
但是,X,Y和Z需要具有相同的大小才能使用此命令。我有尺寸(X)=尺寸(Y)= 1369 X 1369和尺寸(Z)= 37 X 37.我无法弄清楚如何正确克服这种混乱。你能帮忙吗?