Matlab 第一章习题解答Word文档格式.docx
- 文档编号:21912606
- 上传时间:2023-02-01
- 格式:DOCX
- 页数:42
- 大小:1.06MB
Matlab 第一章习题解答Word文档格式.docx
《Matlab 第一章习题解答Word文档格式.docx》由会员分享,可在线阅读,更多相关《Matlab 第一章习题解答Word文档格式.docx(42页珍藏版)》请在冰豆网上搜索。
Relationaloperators.
eq-Equal==
ne-Notequal~=
lt-Lessthan<
gt-Greaterthan>
le-Lessthanorequal<
=
ge-Greaterthanorequal>
Logicaloperators.
relop-Short-circuitlogicalAND&
&
relop-Short-circuitlogicalOR||
and-Element-wiselogicalAND&
or-Element-wiselogicalOR|
not-LogicalNOT~
xor-LogicalEXCLUSIVEOR
any-Trueifanyelementofvectorisnonzero
all-Trueifallelementsofvectorarenonzero
Specialcharacters.
colon-Colon:
paren-Parenthesesandsubscripting()
paren-Brackets[]
paren-Bracesandsubscripting{}
punct-Functionhandlecreation@
punct-Decimalpoint.
punct-Structurefieldaccess.
punct-Parentdirectory..
punct-Continuation...
punct-Separator,
punct-Semicolon;
punct-Comment%
punct-Invokeoperatingsystemcommand!
punct-Assignment=
punct-Quote'
transpose-Transpose.'
ctranspose-Complexconjugatetranspose'
horzcat-Horizontalconcatenation[,]
vertcat-Verticalconcatenation[;
]
subsasgn-Subscriptedassignment(),{},.
subsref-Subscriptedreference(),{},.
subsindex-Subscriptindex
Bitwiseoperators.
bitand-Bit-wiseAND.
bitcmp-Complementbits.
bitor-Bit-wiseOR.
bitmax-Maximumfloatingpointinteger.
bitxor-Bit-wiseXOR.
bitset-Setbit.
bitget-Getbit.
bitshift-Bit-wiseshift.
Setoperators.
union-Setunion.
unique-Setunique.
intersect-Setintersection.
setdiff-Setdifference.
setxor-Setexclusive-or.
ismember-Trueforsetmember.
Seealsoarith,relop,slash,function_handle.
arith
Arithmeticoperators.
+Plus.
X+YaddsmatricesXandY.XandYmusthavethesame
dimensionsunlessoneisascalar(a1-by-1matrix).
Ascalarcanbeaddedtoanything.
-Minus.
X-YsubtractsmatrixXfromY.XandYmusthavethesame
dimensionsunlessoneisascalar.Ascalarcanbesubtracted
fromanything.
*Matrixmultiplication.
X*YisthematrixproductofXandY.Anyscalar(a1-by-1matrix)
maymultiplyanything.Otherwise,thenumberofcolumnsofXmust
equalthenumberofrowsofY.
.*Arraymultiplication
X.*Ydenoteselement-by-elementmultiplication.XandY
musthavethesamedimensionsunlessoneisascalar.
Ascalarcanbemultipliedintoanything.
^Matrixpower.
Z=X^yisXtotheypowerifyisascalarandXissquare.Ifyisan
integergreaterthanone,thepoweriscomputedbyrepeated
multiplication.Forothervaluesofythecalculation
involveseigenvaluesandeigenvectors.
Z=x^YisxtotheYpower,ifYisasquarematrixandxisascalar,
computedusingeigenvaluesandeigenvectors.
Z=X^Y,wherebothXandYarematrices,isanerror.
.^Arraypower.
Z=X.^Ydenoteselement-by-elementpowers.XandY
musthavethesamedimensionsunlessoneisascalar.
Ascalarcanoperateintoanything.
Relop
Relationaloperators.
<
>
Thesixrelationaloperatorsare<
<
=,>
>
=,==,and~=.
A<
BdoeselementbyelementcomparisonsbetweenAandB
andreturnsamatrixofthesamesizewithelementssettological
1(TRUE)wheretherelationistrueandelementssettological0
(FALSE)whereitisnot.AandBmusthavethesamedimensions
(oronecanbeascalar).
&
Element-wiseLogicalAND.
A&
Bisamatrixwhoseelementsarelogical1(TRUE)wherebothA
andBhavenon-zeroelements,andlogical0(FALSE)whereeitherhas
azeroelement.AandBmusthavethesamedimensions(oronecan
beascalar).
Short-CircuitLogicalAND.
BisascalarvaluethatisthelogicalANDofscalarAandB.
Thisisa"
short-circuit"
operationinthatMATLABevaluatesBonly
iftheresultisnotfullydeterminedbyA.Forexample,ifAequals
0,thentheentireexpressionevaluatestological0(FALSE),regard-
lessofthevalueofB.Underthesecircumstances,thereisnoneed
toevaluateBbecausetheresultisalreadyknown.
|Element-wiseLogicalOR.
A|Bisamatrixwhoseelementsarelogical1(TRUE)whereeither
AorBhasanon-zeroelement,andlogical0(FALSE)wherebothhave
zeroelements.AandBmusthavethesamedimensions(oronecan
||Short-CircuitLogicalOR.
A||BisascalarvaluethatisthelogicalORofscalarAandB.
1,thentheentireexpressionevaluatestological1(TRUE),regard-
lessofthevalueofB.Underthesecircumstances,thereisnoneed
~Logicalcomplement(NOT).
~Aisamatrixwhoseelementsarelogical1(TRUE)whereAhaszero
elements,andlogical0(FALSE)whereAhasnon-zeroelements.
xorExclusiveOR.
xor(A,B)islogical1(TRUE)whereeitherAorB,butnotboth,is
non-zero.SeeXOR.
Slash
Matrixdivision.
\Backslashorleftdivision.
A\BisthematrixdivisionofAintoB,whichisroughlythe
sameasINV(A)*B,exceptitiscomputedinadifferentway.
IfAisanN-by-NmatrixandBisacolumnvectorwithN
components,oramatrixwithseveralsuchcolumns,then
X=A\BisthesolutiontotheequationA*X=Bcomputedby
Gaussianelimination.AwarningmessageisprintedifAis
badlyscaledornearlysingular.A\EYE(SIZE(A))producesthe
inverseofA.
IfAisanM-by-NmatrixwithM<
or>
NandBisacolumn
vectorwithMcomponents,oramatrixwithseveralsuchcolumns,
thenX=A\Bisthesolutionintheleastsquaressensetothe
under-oroverdeterminedsystemofequationsA*X=B.The
effectiverank,K,ofAisdeterminedfromtheQRdecomposition
withpivoting.AsolutionXiscomputedwhichhasatmostK
nonzerocomponentspercolumn.IfK<
Nthiswillusuallynot
bethesamesolutionasPINV(A)*B.A\EYE(SIZE(A))producesa
generalizedinverseofA.
/Slashorrightdivision.
B/AisthematrixdivisionofAintoB,whichisroughlythe
sameasB*INV(A),exceptitiscomputedinadifferentway.
Moreprecisely,B/A=(A'
\B'
)'
.See\.
./Arrayrightdivision.
B./Adenoteselement-by-elementdivision.AandB
Ascalarcanbedividedwithanything.
.\Arrayleftdivision.
A.\B.denoteselement-by-elementdivision.AandB
function_
FUNHANDLE=@FUNCTION_NAMEreturnsahandletothenamedfunction,
FUNCTION_NAME.AfunctionhandleisaMATLABvaluethatprovidesa
meansofcallingafunctionindirectly.Youcanpassfunction
handlesincallstootherfunctions(whichareoftencalledfunction
functions).Youcanalsostorefunctionhandlesindatastructuresfor
lateruse(forexample,asHandleGraphicscallbacks).Afunction
handleisoneofthestandardMATLABdatatypes.Itsclassis
'
function_handle'
.
FUNHANDLE=@(ARGLIST)EXPRESSIONconstructsananonymousfunctionand
returnsahandletothatfunction.Thebodyofthefunction,tothe
rightoftheparentheses,i
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Matlab 第一章习题解答 第一章 习题 解答
![提示](https://static.bdocx.com/images/bang_tan.gif)