show_op.m

来自「FISMAT accommodates different arithmetic」· M 代码 · 共 62 行

M
62
字号
function [x,y,m] = show_op(op,par,op2,par2)% [x,y,m] = show_op(op,par,op2,par2)%% Presentation of a setoperations as a 3D graphik and checkerboard plot.% If invoke without lefthand arguments the graphiks is plotted. % Otherwise a matrix for use with mesh, surf, contour etc. is returned. % (For scaling the the x and y vectors in this file.)% The ranges: 0 < x < 1 and 0 < y < 1 .% % par is the method to be used (e.g or()) or for example the GAMMA-operator% IF only one parameter is passed, one two value operator is assumed.% For comparing two operators or one with different parameters, maximal two% operators and two parameters can be passed.%% The resolution is set to 20. If another value is needed, the value for % resxy in this first line of this file must be changed.% op must be given as a string: ''.%% FSTB - Fuzzy Systems Toolbox for MATLAB% Copyright (c) 1993-1996 by Olaf Wolkenhauer% Control Systems Centre at UMIST% Manchester M60 1QD, UK%% 12-May-1994 resxy=20;x = 0:1/resxy:1; y = x;[a,b] = meshgrid(x,y);if nargin==1,                     % one two value operator.  m = feval(op,a,b);elseif (nargin==2 & ~isstr(par)), % one two value operator with a parameter.  m = feval(op,par,a,b);elseif (nargin==2 & isstr(par)),  % two one value operators.  m = feval(op,a,b);  m2= feval(par,a,b);elseif (nargin==3 & isstr(par)), % first op. with parameter, second without.  m = feval(op,par,a,b);  m2= feval(op2,a,b);elseif (nargin==3 & ~isstr(par)),   m = feval(op,a,b);           % second op. with parameter, first without.  m2= feval(par,op2,a,b);elseif nargin==4,              % two one value operators and two parameters.  m = feval(op,par,a,b);  m2= feval(op2,par2,a,b);end;if nargout == 0,  if (nargin==1),     surf(x,y,m);  elseif (nargin==2 & ~isstr(par)),    surf(x,y,m);  else    subplot(2,2,1), surf(x,y,m); grid on    subplot(2,2,2), surf(x,y,m2); grid on    subplot(2,2,3), pcolor(x,y,m);    subplot(2,2,4), pcolor(x,y,m2);  end;end;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?