📄 reduce_size.m
字号:
function [y, ny] = reduce_size(y, ny, esp)
% remove small coefficients with absolute value less than esp
% and revise the index of the element at the upperleft corner
% Copyright (c) 2006 Yi Chen
y = y.*(abs(y) > esp);
if y == 0
y = 0;
else % remove extra zeros
sizey = size(y);
while(sum(abs(y(sizey(1),:)))==0)
y = y(1:sizey(1)-1,:);
sizey = size(y);
end
while(sum(abs(y(1,:)))==0)
sizey = size(y);
y = y(2:sizey(1),:);
ny(1) = ny(1) + 1;
end
sizey = size(y);
while(sum(abs(y(:,sizey(2))))==0)
y = y(:,1:sizey(2)-1);
sizey = size(y);
end
while(sum(abs(y(:,1)))==0)
sizey = size(y);
y = y(:,2:sizey(2));
ny(2) = ny(2) + 1;
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -