实验一

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

实验一1、1)randDescription:r=rand(n)returnsann-by-nmatrixcontainingpseudorandomvaluesdrawnfromthestandarduniformdistributionontheopeninterval(0,1).rand(m,n)orrand([m,n])returnsanm-by-nmatrix.rand(m,n,p,...)orrand([m,n,p,...])returnsanm-by-n-by-p-by-...array.randreturnsascalar.rand(size(A))returnsanarraythesamesizeasA.r=randn(...,'double')orr=randn(...,'single')returnsanarrayofnormalvaluesofthespecifiedclass.Examples:rand(2)ans=0.42180.79220.91570.9595rand(2,1)ans=0.84910.9340a=rand(4)a=0.75770.17120.04620.31710.74310.70600.09710.95020.39220.03180.82350.03440.65550.27690.69480.4387rand(size(a))ans=0.38160.48980.75470.16260.76550.44560.27600.11900.79520.64630.67970.49840.18690.70940.65510.95972)randnThesameasrand.3)normrndDescription:R=normrnd(mu,sigma)generatesrandomnumbersfromthenormaldistributionwithmeanparametermuandstandarddeviationparametersigma.muandsigmacanbevectors,matrices,ormultidimensionalarraysthathavethesamesize,whichisalsothesizeofR.Ascalarinputformuorsigmaisexpandedtoaconstantarraywiththesamedimensionsastheotherinput.R=normrnd(mu,sigma,v)generatesrandomnumbersfromthenormaldistributionwithmeanparametermuandstandarddeviationparametersigma,wherevisarowvector.Ifvisa1-by-2vector,Risamatrixwithv(1)rowsandv(2)columns.Ifvis1-by-n,Risann-dimensionalarray.R=normrnd(mu,sigma,m,n)generatesrandomnumbersfromthenormaldistributionwithmeanparametermuandstandarddeviationparametersigma,wherescalarsmandnaretherowandcolumndimensionsofR.Examples:n2=normrnd(0,1,3,2)n2=1.58770.8351-0.8045-0.24370.69660.21574)mean()Description:M=mean(A)returnsthemeanvaluesoftheelementsalongdifferentdimensionsofanarray.IfAisavector,mean(A)returnsthemeanvalueofA.IfAisamatrix,mean(A)treatsthecolumnsofAasvectors,returningarowvectorofmeanvalues.IfAisamultidimensionalarray,mean(A)treatsthevaluesalongthefirstnon-singletondimensionasvectors,returninganarrayofmeanvalues.M=mean(A,dim)returnsthemeanvaluesforelementsalongthedimensionofAspecifiedbyscalardim.Formatrices,mean(A,2)isacolumnvectorcontainingthemeanvalueofeachrow.Examples:n1=rand(2,4)n1=0.67970.72120.65380.77910.13660.10680.49420.7150n2=mean(n1)n2=0.40810.41400.57400.7470n3=mean(n1,2)n3=0.70840.36315)var()Description:V=var(X)returnsthevarianceofXforvectors.Formatrices,var(X)isarowvectorcontainingthevarianceofeachcolumnofX.ForN-dimensionalarrays,varoperatesalongthefirstnonsingletondimensionofX.TheresultVisanunbiasedestimatorofthevarianceofthepopulationfromwhichXisdrawn,aslongasXconsistsofindependent,identicallydistributedsamples.V=var(X,1)normalizesbyNandproducesthesecondmomentofthesampleaboutitsmean.var(X,0)isequivalenttovar(X).V=var(X,w)computesthevarianceusingtheweightvectorw.Thelengthofwmustequalthelengthofthedimensionoverwhichvaroperates,anditselementsmustbenonnegative.Theelementsofwmustbepositive.varnormalizeswtosumof1.V=var(X,w,dim)takesthevariancealongthedimensiondimofX.Passin0forwtousethedefaultnormalizationbyN-1,or1touseN.Examples:n1=0.90370.19780.47990.85940.89090.03050.90470.80550.33420.74410.60990.57670.69870.50000.61770.1829n2=var(n1)n2=0.07050.10060.03210.0946n3=var(n1,1)n3=0.05290.07540.02410.0710n4=var(n1,1,2)n4=0.08380.13260.02190.03856)xcorr()Description:xcorrestimatesthecross-correlationsequenceofarandomprocess.AutocorrelationishandledasaspecialcaseExamples:t=0:0.1:1;x=sin(t);y=cos(t);r=xcorr(x,y)r=Columns1through9-0.00000.05390.16940.35270.60890.94131.35201.84112.4072Columns10through183.04713.75594.04544.19524.20534.07793.81793.43212.9296Columns19through212.32151.62060.84157)periodogram()Description:PERIODOGRAMPowerSpectralDensity(PSD)estimateviaperiodogrammethod.Pxx=PERIODOGRAM(X)returnsthePSDestimateofthesignalspecifiedbyvectorXinthevectorPxx.Bydefault,thesignalXiswindowedwitharectangularwindowofthesamelengthasX.ThePSDestimateiscomputedusinganFFToflengthgivenbythelargerof256andthenextpowerof2greaterthanthelengthofX.Notethatthedefaultwindow(rectangular)hasa13.3dBsidelobeattenuation.Thismaymaskspectralcontentbelowthisvalue(relative8)fft()Description:FFTDiscreteFouriertransform.FFT(X)isthediscreteFouriertransform(DFT)ofvectorX.Formatrices,theFFToperationisappliedtoeachcolumn.ForN-Darrays,theFFToperationoperatesonthefirstnon-singletondimension.FFT(X,N)istheN-pointFFT,paddedwithzerosifXhaslessthanNpointsandtruncatedifithasmore.FFT(X,[],DIM)orFFT(X,N,DIM)appliestheFFToperationacrossthedimensionDIM.tothepeakspectralcontent).Choosingdifferentwindowswillenableyoutomaketradeoffsbetweenresolution(e.g.,usingarectangularwindow)andsidelobeattenuation(e.g.,usingaHannwindow).SeeWinToolformoredetails.Pxxisthedistributionofpowerperunitfrequency.Forrealsignals,PERIODOGRAMreturnstheone-sidedPSDbydefault;forcomplexsignals,itreturnsthetwo-sidedPSD.Notethataone-sidedPSDcontainsthetotalpoweroftheinputsignal.Pxx=PERIODOGRAM(X,WINDOW)specifiesawindowtobeappliedtoX.WINDOWmustbeavectorofthesamelengthasX.IfWINDOWisawindowotherthanarectangular,theresultingestimateisamodifiedperiodogram.IfWINDOWisspecifiedasempty,thedefaultwindowisused.[Pxx,W]=PERIODOGRAM(X,WINDOW,NFFT)

1 / 17
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功