matlab常用语言汇总2Word文档格式.docx
- 文档编号:19422578
- 上传时间:2023-01-06
- 格式:DOCX
- 页数:14
- 大小:17.01KB
matlab常用语言汇总2Word文档格式.docx
《matlab常用语言汇总2Word文档格式.docx》由会员分享,可在线阅读,更多相关《matlab常用语言汇总2Word文档格式.docx(14页珍藏版)》请在冰豆网上搜索。
holdon
sii=sin(10*t);
plot(t,sii,'
r'
)
helpplot
plot-2-Dlineplot
ThisMATLABfunctioncreatesa2-DlineplotofthedatainYversusthe
correspondingvaluesinX.IfXandYarebothvectors,thentheymusthaveequal
lengthandMATLABplotsYversusX.IfXandYarebothmatrices,thentheymust
haveequalsizeandMATLABplotscolumnsofYversuscolumnsofX.IfoneofXor
Yisavectorandtheotherisamatrix,thenthematrixmusthavedimensions
suchthatoneofitsdimensionsequalsthevectorlength.
plot(X,Y)
plot(X,Y,LineSpec)
plot(X1,Y1,...,Xn,Yn)
plot(X1,Y1,LineSpec1,...,Xn,Yn,LineSpecn)
plot(Y)
plot(Y,LineSpec)
plot(___,Name,Value)
plot(axes_handle,___)
h=plot(___)
plot的参考页
另请参阅gca,hold,legend,LineSpec,title,xlabel,xlim,ylabel,ylim
名为plot的其他函数
simulink/plot,curvefit/plot,finance/plot,fixedpoint/plot,mpc/plot,
rf/plot,wavelet/plot,simscape/simscape.logging.plot
plot(sii,signall,t)
未定义函数或变量'
signall'
。
是不是想输入:
plot(sii,signal,t)
错误使用plot
数据必须为单一矩阵Y或X,Y配对列表
plot(sii,t,signal,t)
plot(t,sii,t,signal)
h=plot(t,signal)
h=
262.0011
set(h,'
color'
'
错误使用handle.handle/set
对象无效或已删除。
174.0048
linewidth'
5)
a=[5,1,2,3]
5123
a
(1)
ans=
5
a(3)
b=[1,2,3;
b=
b(2,3)
6
b(3,2)
索引超出矩阵维度。
b(3,2)=7
070
b(100,101)
b(100,101)=5
a=[1,2,3,4,5,6,7,8,9,10;
11,12,13,14,15,16,17,18,19,20]
12345678910
11121314151617181920
a=[1:
10;
11:
20]
c=3+4i
c=
3.0000+4.0000i
c1=real(c)
c1=
c2=imag(c)
c2=
4
c3=abs(c)
c3=
aa=c3^2-c2^2-c1^
表达式或语句不完整或不正确。
aa=c3^2-c2^2-c1^2
aa=
0
formatlong
aa
theta=atan(c2/c3)
theta=
0.674740942223553
theta=atan(c2/c1)
0.927295218001612
formatshort
cc=5*exp(i*theta)
cc=
close
a=[123;
456;
789]
789
length(a)
size(a)
33
nr=length(a)
nr=
nc=col(a)
未定义与'
double'
类型的输入参数相对应的函数'
col'
helplength
length-Lengthofvectororlargestarraydimension
ThisMATLABfunctionfindsthenumberofelementsalongthelargestdimensionof
anarray.
numberOfElements=length(array)
length的参考页
另请参阅ndims,numel,size
名为length的其他函数
finance/length,fixedpoint/length,instrument/length,distcomp/length,
matlab/length(serial)
nl=size(a)
nl=
[nc,nl]=size(a)
nc=
ones(nc,nl)
111
f1=[123];
f1=[123]
f1=
fliplr(f1)
321
flipud(f1)
zeros(5)
00000
f2[f1f1]
圆括号或方括号不对称或异常。
f2=[f1f1]
f2=
123123
magic(3)
816
357
492
magic(12)
14423141140671371361011133
131311301617127126202112312224
251191182829115114323311111036
10838391051044243101100464797
965051939254558988585985
618382646579786869757472
737170767767668081636284
608687575690915352949549
4898994544102103414010610737
109353411211331301161172726120
121232212412519181281291514132
1213413598138139541421431
d=magic(3)
d=
d(1,)
d
(1)
8
d(1,)
d(1,:
sum(d(1,:
表达式或语句不正确--可能(、{或[不对称。
))
15
sum(d(:
2))
sum(d)
151515
456;
789]
sum(a)
121518
%按列优先
sum(a'
61524
%‘转置
rand(1,10)
0.81470.90580.12700.91340.63240.09750.27850.54690.95750.9649
a=rand(1,10000);
sum(a)/10000
0.4994
sum(a)/length(a)
helpsum
sum-Sumofarrayelements
ThisMATLABfunctionreturnsthesumoftheelementsofAalongthefirstarray
dimensionwhosesizedoesnotequal1:
S=sum(A)
S=sum(A,dim)
S=sum(___,type)
sum的参考页
另请参阅cumsum,diff,isfloat,prod
名为sum的其他函数
fixedpoint/sum
prod(a)
b=randn(1,10)
-1.0896-1.22080.7074-0.0699-0.4863-0.2566-0.1070-0.9489-0.2113-0.8603
mean(b)
-0.4543
var(b)
0.3464
b=randn(1,10000)
0.9757
2*randn(1,10)
-3.61760.33041.51051.1306-0.84281.8199-2.6268-3.94682.02010.2183
helphist
hist-Histogramplot
ThisMATLABfunctioncreatesahistogrambarplotofdata.
hist(data)
hist(data,nbins)
hist(data,xvalues)
hist(axes_handle,___)
nelements=hist(___)
[nelements,centers]=hist(___)
hist的参考页
另请参阅bar,ColorSpec,histc,mode,patch,rose,stairs
名为hist的其他函数
finance/hist,fixedpoint/hist
hist(b)
hist(b,1000)
eye(4)
1000
0100
0010
0001
c=magic(3)
eye(c)
错误使用eye
不支持N维数组。
sum
b=eye(3)
100
010
001
c.*b
800
050
002
sum(sum(c.*b))
linspace(0,1);
linspace(0,1,10)
00.11110.22220.33330.44440.55560.66670.77780.88891.0000
a=logspace(0,2,10)
1.00001.66812.78264.64167.742612.915521.544335.938159.9484100.0000
plot(a)
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- matlab 常用 语言 汇总