我在创建的网格上执行缩放操作。但尺寸似乎不适合缩放网格。有什么想法怎么做? 代码:
% plot grid
[X,Y] = meshgrid(-1:0.1:5, 0:0.1:1);
X = X(:);
Y = Y(:);
plot(X,Y,'b.');
xlabel('X');
ylabel('Y');
sx = 0.75;
sy = 0.6;
Tscale = [sx 0 0;
0 sy 0;
0 0 1];
Scale_val=Tscale*[X Y].';
X_Scale=Scale_val(1,:);
Y_Scale=Scale_val(2,:);
figure, plot(X_Scale, Y_Scale);
错误:
Error using *
Inner matrix dimensions must agree.
Error in: Scale_val=Tscale*[X Y].';
答案 0 :(得分:0)
Scale_val=Tscale*[X Y].';
Tscale = [sx 0 0;
0 sy 0;
0 0 1];
Scale_val=Tscale*[X'; Y'; zeros(1,length(X))];
X_Scale=Scale_val(1,:);
Y_Scale=Scale_val(2,:);
figure, plot(X_Scale, Y_Scale,'*');