📄 pdiscrim.m~
字号:
function pdiscrim( D, X, Y, background, linestyle )% PDISCRIM plot discriminat functions regions in 2D.% pdiscrim( D, X, Y )%% Input:% D [m x n] value of discriminat function in the binary case or% D [c x (m*n)] values of discriminant functions for all the % classes in the multi-class case.% X [1 x m] values of x-axis.% Y [1 x n] values of y-axis, e.g. X=[1:10], Y=[1:10] (mash 10x10).% % Modifications:% 23-sep-2002, VF% 21-may-2001, V.Franc, createdif nargin < 4, background = 1;endif nargin < 5, linestyle = 'k';enddx=X(2)-X(1);dy=Y(2)-Y(1);m = size( X, 2 );n = size( Y, 2 );Z = -inf*ones( m+2, n+2 );nclass = size(D,1);if lenght( size( D )) == 2, A=D; l=(-min(A)+max(A))/2; A = reshape( A', m, n ); if background, phandle = pcolor(X,Y,A'); shading interp; end contour(X,Y,A',[0 0],linestyle); if background, set(phandle, 'LineStyle','none' ); set(gca,'Clim',[-l l]); load cmp1; colormap( cmp );
end elseif nclass == 2, A=D(1,:) - D(2,:); l=(-min(A)+max(A))/2; A = reshape( A', m, n ); if background, phandle = pcolor(X,Y,A'); shading interp; end contour(X,Y,A',[0 0],linestyle); if background, set(phandle, 'LineStyle','none' ); set(gca,'Clim',[-l l]); load cmp1; colormap( cmp );
end else for i = 1: nclass, A = D(i,:) - max(D(find([1:nclass] ~= i),:)); A = reshape( A', m, n ); Z(2:end-1,2:end-1) = A; [cc,h] = contour([X(1)-dx,X,X(end)+dx],[Y(1)-dy,Y,Y(end)+dy],Z',[0 0],... linestyle); if background, while ~isempty(cc) len = cc(2,1); fill(cc(1,2:len+1),cc(2,2:len+1),color(i)); cc(:,1:len+1) = []; end end endendreturn;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -