topdir.m
来自「为stanford大学donoho教授所编写的redgit变换源代码。是用c编写」· M 代码 · 共 47 行
M
47 行
function topdir(ra, n, sorp)
% Plot the top n projections of FRAT
if exist('n', 'var') == 0
K = [1:5];
elseif length(n) == 1
K = [1:n];
else
K = n;
end
n = length(K);
% Figure out the represented directions
p = size(ra, 1);
s = bestdir(p);
% Energy from each projection
var_ra = var(ra, 1);
total_var = sum(var_ra);
% Sort into decending order
[sort_var, sort_ind] = sort(var_ra);
sort_var = fliplr(sort_var);
sort_ind = fliplr(sort_ind);
% Plot the top n projections (which highest energy)
xrange = [1, size(ra, 1)];
for i = 1:n,
subplot(n, 1, i),
if exist('sorp', 'var') & sorp == 's'
stem(ra(:,sort_ind(K(i))), '.'),
else
plot(ra(:,sort_ind(K(i)))),
end
title(sprintf('Direction: (a,b) = (%d,%d); Energy = %.2f%%', ...
s(1, sort_ind(K(i))), s(2, sort_ind(K(i))), ...
100 * sort_var(K(i))/ total_var)),
set(gca, 'XTickLabel', []);
set(gca, 'XLim', xrange);
% Zero line in the midle for y axis
ymax = 1.1 * max(abs(ra(:,sort_ind(K(i)))));
set(gca, 'YLim', [-ymax, ymax]);
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?