(12+2*(7-4))/3^2ans =2format short;pians =3.1416format long;pians =3.141592653589793format rat;pians =355/113format long;vpa(pi,50)ans =3.141592653589793115997963468544185161590576171875whoYour variables are:ansa=randn(4)a =-0.1241 0.6715 0.4889 0.29391.4897 -1.2075 1.0347 -0.78731.4090 0.7172 0.7269 0.88841.4172 1.6302 -0.3034 -1.1471whosName Size Bytes Class Attributesa 4x4 128 doubleans 1x1 8 doublewhoYour variables are:a answhatM-files in the current directory E:\Matlab2010\智能仿生算法\遗传算法TSP_SuiJiSuanFa ZhuanJiaXiTongP167 fun_SuiJiSuanFa TSPrun_SuiJiSuanFa f fun_SuiJiSuanFa0ZhuanJiaXiTongP162 f1 fun_SuiJiSuanFa2MAT-files in the current directory E:\Matlab2010\智能仿生算法\遗传算法my27citydir. ZhuanJiaXiTongP162.asv f.m my27city.mat.. ZhuanJiaXiTongP162.m f1.m temp3d.asv ZhuanJiaXiTongP167.asv fun_SuiJiSuanFa.asv temp.prj3d.m ZhuanJiaXiTongP167.m fun_SuiJiSuanFa.m zia03836New Folder bou2_4l.shp fun_SuiJiSuanFa0.asv TSP_SuiJiSuanFa.m da fun_SuiJiSuanFa0.m TSPrun_SuiJiSuanFa.m da.prj fun_SuiJiSuanFa2.m type 3dclf;x=-3:0.1:3;y=-3:0.1:3;[X Y]=meshgrid(x,y);Z=f(X,Y)+4;mesh(X,Y,Z);hold on;plot3(-0.7,-1,f(-0.7,-1)+4,'g*');contour(X,Y,Z,'r');which randbuilt-in (D:\Program Files\MATLAB\R2010a\toolbox\matlab\randfun\rand) which 3d.mE:\Matlab2010\智能仿生算法\遗传算法\3d.mhelp existEXIST Check if variables or functions are defined.EXIST('A') returns:0 if A does not exist1 if A is a variable in the workspace2 if A is an M-file on MATLAB's search path. It also returns 2 whenA is the full pathname to a file or when A is the name of an ordinary file on MATLAB's search path3 if A is a MEX-file on MATLAB's search path4 if A is a MDL-file on MATLAB's search path5 if A is a built-in MATLAB function6 if A is a P-file on MATLAB's search path7 if A is a directory8 if A is a Java classEXIST('A') or EXIST('A.EXT') returns 2 if a file named 'A' or'A.EXT'and the extension isn't a P or MEX function extension.EXIST('A','var') checks only for variables.EXIST('A','builtin') checks only for built-in functions.EXIST('A','file') checks for files or directories.EXIST('A','dir') checks only for directories.EXIST('A','class') checks only for Java classes.If A specifies a filename, MATLAB attempts to locate the file,examines the filename extension, and determines the value toreturn based on the extension alone. MATLAB does not examinethe contents or internal structure of the file.When searching for a directory, MATLAB finds directories that are partof MATLAB's search path. They can be specified by a partial path. Italso finds the current working directory specified by a partial path,and subdirectories of the current working directory specified bya relative path.EXIST returns 0 if the specified instance isn't found.See also DIR, WHAT, ISEMPTY, PARTIALPATH.Overloaded methods:inline/existfittype/existComposite/existReference page in Help browserdoc existmatlabrootans =D:\Program Files\MATLAB\R2010adiary('myJog')c=rand(5)c =0.1839 0.9448 0.3692 0.4039 0.57520.2400 0.4909 0.1112 0.0965 0.05980.4173 0.4893 0.7803 0.1320 0.23480.0497 0.3377 0.3897 0.9421 0.35320.9027 0.9001 0.2417 0.9561 0.8212diary offd=randn(6)d =-1.3320 -0.1303 -0.8487 0.6601 0.0513 0.1832-2.3299 0.1837 -0.3349 -0.0679 0.8261 -1.0298-1.4491 -0.4762 0.5528 -0.1952 1.5270 0.9492 0.3335 0.8620 1.0391 -0.2176 0.4669 0.3071 0.3914 -1.3617 -1.1176 -0.3031 -0.2097 0.1352 0.4517 0.4550 1.2607 0.0230 0.6252 0.5152 diary tempdiary onstr='hello!'str =hello!bstr=int8(str)bstr =104 101 108 108 111 33str2='I''m a student'str2 =I'm a studentx=int16(32501)x =32501whos xName Size Bytes Class Attributesx 1x1 2 int16xType=class(x)xType =int16isinteger(x)ans =1str3='The range for double is :\n\t%g to %g';sprintf(str3,realmin,realmax)ans =The range for double is :2.22507e-308 to 1.79769e+308x=5.73*10^300x =5.7300e+300y=int64(-589324077574)x=double(y)y =-589324077574x =-5.8932e+011x=single(25.783)x =25.7830whos xName Size Bytes Class Attributesx 1x1 4 singlex=2+3ix =2.0000 +3.0000ix=rand(3)*5;y=rand(3)*-8;z=complex(x,y)z =3.6517 - 3.9112i 1.1864 - 3.1641i 2.7340 - 0.3019i 2.4430 -4.9925i 2.2942 - 2.9395i 2.6057 - 7.0813i 2.8926 -5.4331i 4.8154 - 7.9039i 1.1580 - 7.3063i[30 40 50 60 70 ]>40ans =0 0 1 1 1s='matrix laboratory's =matrix laboratorysize(s)ans =1 17dt=nowdt =7.3574e+005t=datenum('12/24/1984 12:45')t =7.2500e+005datevec(t)ans =1984 12 24 12 45datevec(now)ans =1.0e+003 *2.0140 0.0050 0.0170 0.0090 0.0440 0.0239format shortwhosName Size Bytes Class Attributesans 1x6 48 doublebstr 1x6 6 int8dt 1x1 8 doubles 1x17 34 charstr 1x6 12 charstr2 1x13 26 charstr3 1x37 74 chart 1x1 8 doublex 3x3 72 doublexType 1x5 10 chary 3x3 72 doublez 3x3 144 double complexwhoYour variables are:ans bstr dt s str str2 str3 t x xType y zdiary off。