资源描述:
《Matlab数学常用的调用函数.docx》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、max%求最大值LargestelementsinarraySyntaxC=max(A)C=max(A,B)C=max(A,[],dim)[C,I]=max(...)DescriptionC=max(A)returnsthelargestelementsalongdifferentdimensionsofanarray.IfAisavector,max(A)returnsthelargestelementinA.A=[123;456;789]A=123456789max(A)ans=789IfAisamatrix,max(A)tre
2、atsthecolumnsofAasvectors,returningarowvectorcontainingthemaximumelementfromeachcolumn.IfAisamultidimensionalarray,max(A)treatsthevaluesalongthefirstnon-singletondimensionasvectors,returningthemaximumvalueofeachvector.C=max(A,B)returnsanarraythesamesizeasAandBwiththela
3、rgestelementstakenfromAorB.ThedimensionsofAandBmustmatch,ortheymaybescalar.B=[789;101112;131415]B=789101112131415C=max(A,B)C=789101112131415C=max(A,[],dim)returnsthelargestelementsalongthedimensionofAspecifiedbyscalardim.Forexample,max(A,[],1)producesthemaximumvaluesal
4、ongthefirstdimension(therows)ofA.C=max(A,[],1)C=789C=max(A,[],2)C=3619[C,I]=max(...)findstheindices(指标index的复数)ofthemaximumvaluesofA,andreturnstheminoutputvectorI.Ifthereareseveralidenticalmaximumvalues,theindexofthefirstonefoundisreturned.[CI]=max(A)C=789I=333RemarksF
5、orcomplexinputA,maxreturnsthecomplexnumberwiththelargestcomplexmodulus(magnitude),computedwithmax(abs(A)).Thencomputesthelargestphaseanglewithmax(angle(x)),ifnecessary.ThemaxfunctionignoresNaNs.A=[i2i1+3i;5-i6i8+0.5i]A=0+1.0000i0+2.0000i1.0000+3.0000i5.0000-1.0000i0+6.
6、0000i8.0000+0.5000imax(A)%求得是A中模最大的元素ans=5.0000-1.0000i0+6.0000i8.0000+0.5000iabs(A)ans=1.00002.00003.16235.09906.00008.0156max(abs(A))ans=5.09906.00008.0156max(angle(A))ans=1.57081.57081.2490angle(A)ans=1.57081.57081.2490-0.19741.57080.0624min%求最小值Smallestelementsinar
7、raySyntaxC=min(A)C=min(A,B)2C=min(A,[],dim)[C,I]=min(...)DescriptionC=min(A)returnsthesmallestelementsalongdifferentdimensionsofanarray.IfAisavector,min(A)returnsthesmallestelementinA.IfAisamatrix,min(A)treatsthecolumnsofAasvectors,returningarowvectorcontainingtheminim
8、umelementfromeachcolumn.IfAisamultidimensionalarray,minoperatesalongthefirstnonsingletondimension.C=min(A,B)returnsan