信号处理仿真MATLAB实验16.docx

上传人:b****2 文档编号:3148248 上传时间:2023-05-05 格式:DOCX 页数:24 大小:227.85KB
下载 相关 举报
信号处理仿真MATLAB实验16.docx_第1页
第1页 / 共24页
信号处理仿真MATLAB实验16.docx_第2页
第2页 / 共24页
信号处理仿真MATLAB实验16.docx_第3页
第3页 / 共24页
信号处理仿真MATLAB实验16.docx_第4页
第4页 / 共24页
信号处理仿真MATLAB实验16.docx_第5页
第5页 / 共24页
信号处理仿真MATLAB实验16.docx_第6页
第6页 / 共24页
信号处理仿真MATLAB实验16.docx_第7页
第7页 / 共24页
信号处理仿真MATLAB实验16.docx_第8页
第8页 / 共24页
信号处理仿真MATLAB实验16.docx_第9页
第9页 / 共24页
信号处理仿真MATLAB实验16.docx_第10页
第10页 / 共24页
信号处理仿真MATLAB实验16.docx_第11页
第11页 / 共24页
信号处理仿真MATLAB实验16.docx_第12页
第12页 / 共24页
信号处理仿真MATLAB实验16.docx_第13页
第13页 / 共24页
信号处理仿真MATLAB实验16.docx_第14页
第14页 / 共24页
信号处理仿真MATLAB实验16.docx_第15页
第15页 / 共24页
信号处理仿真MATLAB实验16.docx_第16页
第16页 / 共24页
信号处理仿真MATLAB实验16.docx_第17页
第17页 / 共24页
信号处理仿真MATLAB实验16.docx_第18页
第18页 / 共24页
信号处理仿真MATLAB实验16.docx_第19页
第19页 / 共24页
信号处理仿真MATLAB实验16.docx_第20页
第20页 / 共24页
亲,该文档总共24页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

信号处理仿真MATLAB实验16.docx

《信号处理仿真MATLAB实验16.docx》由会员分享,可在线阅读,更多相关《信号处理仿真MATLAB实验16.docx(24页珍藏版)》请在冰点文库上搜索。

信号处理仿真MATLAB实验16.docx

信号处理仿真MATLAB实验16

 

信号处理仿真(MATLAB)

实验指导书

 

青岛大学自动化工程学院电子工程系

2006年4月

 

MATLAB实验一

一、实验目的:

1.BefamiliarwithMATLABEnvironment

2.Befamiliarwitharrayandmatrix

3.BefamiliarwithMATLABoperationsandsimpleplotfunction

二、实验内容:

1.BefamiliarwithMatlab6.5

StartupMatlab6.5,browsethemajortoolsoftheMatlabdesktop

⏹TheCommandWindows

⏹TheCommandHistoryWindows

⏹LaunchPad

⏹TheEdit/DebugWindow

⏹FigureWindows

⏹WorkspaceBrowserandArrayEditer

⏹HelpBrowser

⏹CurrentDirectoryBrowser

PARTI:

下列选择练习,不需提交实验报告

1.Givetheanswerofthefollowingquestionsforthearray

1)Whatisthesizeofarray1?

size(array)45

2)Whatisthevalueofarray1(4,1)?

3)Whatisthesizeandvalueofarray1(:

1:

2)?

1.10000

01.1000

2.10000.1000

-1.40005.1000

4)Whatisthesizeandvalueofarray1([13], end)?

6.0000

1.3000

2.Givetheanswerofthefollowingcommad

1)a=1:

2:

5;

a=135

2)b=[a’a’a’];

b=

111

333

555

3)c=b(1:

2:

3,1:

2:

3);

c=11

55

4)d=a+b(2,:

d=468

5)w=[zeros(1,3) ones(3,1)’ 3:

5’]

w=000111345

3.Givetheanswerofthesub-arrays

1)array1(3,:

);2.10000.10000.3000-0.40001.3000

2)array1(:

3);2.1000

-6.6000

0.3000

0

3)array1(1:

2:

3,[334])

2.10002.1000-3.5000

0.30000.3000-0.4000

4)array1([11],:

1.100002.1000-3.50006.0000

1.100002.1000-3.50006.0000

4.Givetheanswerofthefollowingoperations

1)a+b

3-3

-14

2)a*d2-2

-12

3)a.*d20

02

4)a*c6

-5

5)a.*cwrong

6)a\b

1.00001.0000

0.50001.5000

7)a.\b

0.50000.5000

01.0000

8)a.^b

2.0000-0.5000

1.00004.0000

PARTI:

下列选择练习,不需提交实验报告

1.Edit&Runthem-file

%teststepresponsefunction

wn=6;kosi=[0.1:

0.1:

1.02];

figure

(1);holdon

forkos=kosi

num=wn^2;den=[1,2*kos*wn,wn.^2];step(num,den);step阶跃响应num分子den分母适量矩阵

end

holdoff;

2.Edit&Runthem-file

%testplotfunction

x=0:

pi/20:

3*pi;y1=sin(x);y2=2*cos(2*x);plot(x,y1,'rv:

',x,y2,'bo--');

title('PlottheLineofy=sin(2x)anditsderivative');xlabel('Xaxis');ylabel('Yaxis');

legend('f(x)','d/dxf(x)');gridon;

3.Edit&Runthem-file

%testsubplotandloglogfunction

x=0:

0.1:

10;y=x.^2-10.*x+26;

subplot(2,2,1);plot(x,y);gridon;

subplot(2,2,2);semilogx(x,y);gridon;

subplot(2,2,3);semilogy(x,y);gridon;

subplot(2,2,4);loglog(x,y);gridon;

4.Edit&Runthem-file

%testmaxandplotfunction

volts=120;rs=50;rl=1:

0.1:

100;

amps=volts./(rs+rl);pl=(amps.^2).*rl;[maxvol,index]=max(pl);

plot(rl,pl,rl(index),pl(index),'rh');gridon;

MATLAB实验二

一、实验目的:

1.Learntodesignbranchstatementsprogram

2.Befamiliarwithrelationalandlogicaloperators

3.Practice2Dplotting

二、实验内容:

PARTI:

(选择练习,不需提交实验报告)

1.Holdcommandexercise

x=-pi:

pi/20:

pi;

y1=sin(x);y2=cos(x);plot(x,y1,'b-');holdon;

plot(x,y2,'k--');holdoff;

legend('sinx','cosx')

2.Figurecommandexercise

figure

(1);

subplot(2,1,1);

x=-pi:

pi/20:

pi;y=sin(x);plot(x,y);gridon;

title('Subplot1Title');

subplot(2,1,2);

x=-pi:

pi/20:

pi;y=cos(x);plot(x,y);gridon;

title('Subplot2Title');

3.PolarPlotsexercise

g=0.5;

theta=0:

pi/20:

2*pi;

gain=2*g*(1+cos(theta));

polar(theta,gain,'r-');

title('\fontsize{20}\bfGainversusangle\theta');

4.Assumethata,b,c,anddaredefined,andevaluatethefollowingexpression.

a=20;b=-2;c=0;d=1;

(1)a>b;

(2)b>d;(3)a>b&c>d;(4)a==b;(5)a&b>c;6)~~b;

a=2;b=[1–2;-010];c=[01;20];d=[-212;010];

(7)~(a>b)(8)a>c&b>c(9)c<=d

a=2;b=3;c=10;d=0;

(10)a*b^2>a*c(11)d|b>a(12)(d|b)>a

a=20;b=-2;c=0;d=’Test’;

(13)isinf(a/b)(14)isinf(a/c)(15)a>b&ischar(d)(16)isempty(c)

5.WriteaMatlabprogramtosolvethefunction

wherexisanumber<1.Useanifstructuretoverifythatthevaluepassedtotheprogramislegal.Ifthevalueofxislegal,caculatey(x).Ifnot,writeasuitableerrormessageandquit.

PARTII:

(需提交实验报告)

1.

3.Writeoutm.fileandplotthefigureswithgrids

Assumethatthecomplexfunctionf(t)isdefinedbytheequation

f(t)=(0.5-0.25i)t-1.0

Plottheamplitudeandphaseoffunctionfor

t=0:

0.1:

4;

ft=(0.5-0.25i)*t-1.0;

amp=abs(ft);

phase=angle(ft);

subplot(211);

plot(amp,t);

title('ft的幅度相位图')

xlabel('taxis');ylabel('ft幅度axis');

gridon

subplot(212);

plot(phase,t);

xlabel('taxis');ylabel('ft相位axis');

gridon

4.WritetheMatlabstatementsrequiredtocalculatey(t)fromtheequation

forvalueoftbetween–9and9instepsof0.5.Useloopsandbranchestoperformthiscalculation.

5.Homework:

需提交实验报告

Seethetextbookpage73:

2.12,2.13,2.15,2.16

 

MATLAB实验三

一、实验目的:

1.Learntodesignloopstatementsprogram

2.Befamiliarwithrelationalandlogicaloperators

3.Practice2Dplotting

二、实验内容:

PARTI:

(选择练习,不需提交实验报告)

4.Comparethe3approachesfollows(LoopsandVectorization)

%A.PerformcalculationbyForLoopwithpre-initializearray

tic;

square=zeros(1,10000)%pre-initializearray

forii=1:

10000

square(ii)=ii^2;

square_root(ii)=ii^(1/2);

cube_root(ii)=ii^(1/3);

end

toc;t1=toc

%B.PerformcalculationbyForLoopwithoutpre-initializearray

tic;

forii=1:

10000

square(ii)=ii^2;

square_root(ii)=ii^(1/2);

cube_root(ii)=ii^(1/3);

end

toc;t2=toc

%C.Performcalculationwithvectors

tic;

ii=1:

10000

square(ii)=ii.^2;

square_root(ii)=ii.^(1/2);

cube_root(ii)=ii.^(1/3);

end

toc;t3=toc

Homework:

需提交实验报告

Page131:

3.2,3.4,3.8,3.11

MATLAB实验四

一、实验目的:

1.LearntowriteMATLABfunctions

2.Befamiliarwithcomplexdataandcharacterdata

3.Practice2Dplotting

二、实验内容:

Derivativeofafunction.

1.WritethreeMatlabfunctionstocalculatethehyperbolicsine,cosine,and

tangentfunctions:

thenplottheshapesofhyperbolicsine,cosine,andtangentfunctionsononefigure,

.

2.Writeaprogramusethefunction

andplottheline,

andsearchfortheminimumandmaximumin200stepsovertherangeof

marktheminimumandmaximumonthelinefigure.

3.Writeafunctiontocalculatethedistancebetweentwopoints

and

thatthepointsshouldbegivenby‘input’function.

4.Writeafunctioncomplex_tothatacceptacomplexnumbervar,andreturnstwooutputargumentscontainingthemagnitudemagandanglethetaofthecomplexnumber.Theoutputangleshouldbeindegrees.

Writeanotherfunctionpolar_to_complexthatacceptstwoinputargumentscontainingthemagnitudemagandanglethetaofthecomplexnumberindegrees,andreturnsthecomplexnumbervar.

4.Writeaprogramthatacceptsaseriesofstringsfromauserwiththeinputfunction,sortsthestringsintoascendingorder,andprintsthemout.

Derivativeofafunction.Thederivativeofacontinuousfunctionf(x)isdefinedbytheequation

Inasampledfunction,thisdefinitionbecomes

where

Homeworks:

需提交实验报告

Page181:

4.15,4.16,4.19,4.20,4.27

MATLAB实验五

一、实验目的:

1.Befamiliarwithcomplexdataandcharacterdata

2.ractice2Dplotting

二、实验内容:

1.WritethreeMatlabfunctionstocalculatethehyperbolicsine,cosine,and

tangentfunctions:

thenplottheshapesofhyperbolicsine,cosine,andtangentfunctionsononefigure,

.

2.Writeaprogramusethefunction

andplottheline,

andsearchfortheminimumandmaximumin200stepsovertherangeof

marktheminimumandmaximumonthelinefigure.

3.Writeafunctiontocalculatethedistancebetweentwopoints

and

thatthepointsshouldbegivenby‘input’function.

4.Writeafunctioncomplex_tothatacceptacomplexnumbervar,andreturnstwooutputargumentscontainingthemagnitudemagandanglethetaofthecomplexnumber.Theoutputangleshouldbeindegrees.

Writeanotherfunctionpolar_to_complexthatacceptstwoinputargumentscontainingthemagnitudemagandanglethetaofthecomplexnumberindegrees,andreturnsthecomplexnumbervar.

5.Writeaprogramthatacceptsaseriesofstringsfromauserwiththeinputfunction,sortsthestringsintoascendingorder,andprintsthemout.

Homeworks:

需提交实验报告

Page181:

5.8,5.10,5.14,5.16,5.17,5.22,5.24

MATLAB实验六

一、实验目的:

1.Practice2Dplottingand3Dplotting

2.Learntousefplotfunction

3.Befamiliarwithcellarraysandstructurearrays

二、实验内容:

1.Givethe3Dplotfigureof

useplot3function,

andgridon,linewidthis3.0.

t=-10:

0.1:

10;

x=exp(-0.3*t).*sin(3*t);

y=exp(-0.1*t).*cos(t);

plot3(x,y,t,'linewidth',3);gridon

xlabel('x')

ylabel('y')

zlabel('z')

2.Plotthefunction

step0.1.Createthefollowingplottypes:

(a)stemplot;(b)stairplot;(c)barplot;(d)compassplot.

x=0:

0.1:

2;

y=exp(-x).*sin(x);

subplot(221);stem(x,y);

subplot(222);stairs(x,y);

subplot(223);bar(x,y);

subplot(224);compass(x,y);

3.Plotthefunction

overtherange

usingfunctionfplot,andgridon.

functiony=myfun(x)

y=1./sqrt(x);

fh=@myfun;

fplot(fh,[020]);gridon

4.Createacellarrays:

a={[143;058;729],'annesmith',3+7i;5-2i,-3.14,[];3.14,[],5}

a=

[3x3double]'annesmith'[3.0000+7.0000i]

[5.0000-2.0000i][-3.1400][]

[3.1400][][5]

5.Createastructurearraysandtocalculatethemeanbillingofthreepatients:

Homeworks:

需提交实验报告

Page285:

6.4,6.9,6.11

MATLAB实验七

一、实验目的:

BefamiliarwithInput/Outputfunctions

二、实验内容:

1.Writeam-file.Them-filecreatesanarraycontaining

randomvalues,sortsthearrayintoascendingorder,opensauser-specifiedfileforwritingonly,thenwritesthearraytodiskin32-bitfloating-pointformat,andclosethefile.Itthenopensthefileandreadthedatabackinto

array.

2.Editafileasdata4_4.txtthatcontains

squarematrix,thenimportthearrayuseuiimportfunction,andcalculatetheinverseofthesquarematrix.

3.

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 工程科技 > 能源化工

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2