|
figure;
myimage(E,'3D');
右下角的竖线怎么没画出来呢?
function h=myimage(dummyCoefs,plotmode,cmap)
% MYIMAGE 3-D visualization of coefficients.
% DUMMYCOEFS is the coefficients matrix to be visualized.
% Coefficients are colored using PLOTMODE.
% PLOTMODE = 'lvl' (By scale) or
% PLOTMODE = 'glb' (All scales) or
% PLOTMODE = 'abslvl' or 'lvlabs' (Absolute value and By scale) or
% PLOTMODE = 'absglb' or 'glbabs' (Absolute value and All scales)
%
% MYIMAGE(...,'plot') is equivalent to MYIMAGE(...,'absglb')
%
% You get 3-D plots (surfaces) using the same keywords listed
% above for the PLOTMODE parameter, preceded by '3D'. For example:
% MYIMAGE(...,'3Dplot') or MYIMAGE(...,'3Dlvl').
% H is the figure handle.
%----------------------------------------------------------------------
if nargin==1
plotmode='plot';
cmap=colormap(jet(240));
end
if nargin==2
cmap=colormap(jet(240));
end
NBC = 240;
if strmatch('3D',plotmode)
dim_plot = '3D';
else
dim_plot = '2D';
end
switch plotmode
case {'lvl','3Dlvl'}
lev_mode = 'row';
abs_mode = 0;
case {'glb','3Dglb'}
lev_mode = 'mat';
abs_mode = 0;
case {'abslvl','lvlabs','3Dabslvl','3Dlvlabs'}
lev_mode = 'row';
abs_mode = 1;
case {'absglb','glbabs','plot','2D','3Dabsglb','3Dglbabs','3Dplot','3D'}
lev_mode = 'mat';
abs_mode = 1;
otherwise
plotmode = 'absglb';
lev_mode = 'mat';
abs_mode = 1;
dim_plot = '2D';
end
if abs_mode , dummyCoefs = abs(dummyCoefs); end
plotPARAMS = {NBC,lev_mode,abs_mode,cmap};
switch dim_plot
case '2D'
axeAct = gca;
plotCOEFS(axeAct,dummyCoefs,plotPARAMS);
h=axeAct;
case '3D'
axeAct = gca;
surfCOEFS(axeAct,dummyCoefs,plotPARAMS);
h=axeAct;
end
%----------------------------------------------------------------------
function plotCOEFS(axeAct,coefs,plotPARAMS)
[NBC,lev_mode,abs_mode,cmap] = deal(plotPARAMS{:});
coefs = wcodemat(coefs,NBC,lev_mode,abs_mode);
img = image(coefs);
set(axeAct,'YDir','normal','Box','On');
title('Matrix''s 2-D Visualization','Parent',axeAct);
xlabel('x','Parent',axeAct);
ylabel('y','Parent',axeAct);
colormap(cmap);
%----------------------------------------------------------------------
function surfCOEFS(axeAct,coefs,plotPARAMS)
[NBC,lev_mode,abs_mode,cmap] = deal(plotPARAMS{:});
img = surf(coefs);
set(axeAct,'YDir','normal','Box','On');
title('Matrix''s 3-D Visualization','Parent',axeAct);
xlabel('time','Parent',axeAct);
ylabel('frequency','Parent',axeAct);
zlabel('amplitude','Parent',axeAct);
xl = [1 size(coefs,2)];
yl = [1 size(coefs,1)];
zl = [min(min(coefs)) max(max(coefs))];
set(axeAct,'Xlim',xl,'Ylim',yl,'Zlim',zl,'view',[-30 35]);
colormap(cmap);
shading('interp') |
|