信号处理仿真MATLAB实验已做.docx

上传人:b****2 文档编号:3595620 上传时间:2023-05-06 格式:DOCX 页数:15 大小:162.01KB
下载 相关 举报
信号处理仿真MATLAB实验已做.docx_第1页
第1页 / 共15页
信号处理仿真MATLAB实验已做.docx_第2页
第2页 / 共15页
信号处理仿真MATLAB实验已做.docx_第3页
第3页 / 共15页
信号处理仿真MATLAB实验已做.docx_第4页
第4页 / 共15页
信号处理仿真MATLAB实验已做.docx_第5页
第5页 / 共15页
信号处理仿真MATLAB实验已做.docx_第6页
第6页 / 共15页
信号处理仿真MATLAB实验已做.docx_第7页
第7页 / 共15页
信号处理仿真MATLAB实验已做.docx_第8页
第8页 / 共15页
信号处理仿真MATLAB实验已做.docx_第9页
第9页 / 共15页
信号处理仿真MATLAB实验已做.docx_第10页
第10页 / 共15页
信号处理仿真MATLAB实验已做.docx_第11页
第11页 / 共15页
信号处理仿真MATLAB实验已做.docx_第12页
第12页 / 共15页
信号处理仿真MATLAB实验已做.docx_第13页
第13页 / 共15页
信号处理仿真MATLAB实验已做.docx_第14页
第14页 / 共15页
信号处理仿真MATLAB实验已做.docx_第15页
第15页 / 共15页
亲,该文档总共15页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

信号处理仿真MATLAB实验已做.docx

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

信号处理仿真MATLAB实验已做.docx

信号处理仿真MATLAB实验已做

 

信号处理仿真(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?

3行5列

2)Whatisthevalueofarray1(4,1)?

1.4

3)Whatisthesizeandvalueofarray1(:

1:

2)?

ans=

1.10000

01.1000

2.10000.1000

1.40005.1000

4)Whatisthesizeandvalueofarray1([13], end)?

ans=

6.0000

1.3000

2.Givetheanswerofthefollowingcommad

1)a=1:

2:

5;2)b=[a’a’a’];3)c=b(1:

2:

3,1:

2:

3);

4)d=a+b(2,:

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

5’]

3.Givetheanswerofthesub-arrays

Array=1.10.02.1-3.56.0

1.01.1-6.62.83.4

2.10.10.3-0.41.3

-1.45.10.01.10.0

1)array1(3,:

);2)array1(:

3);3)array1(1:

2:

3,[334])4)array1([11],:

1)2.10000.10000.3000-0.40001.3000

2)2.1000

-6.6000

0.3000

0

3)2.10002.1000-3.5000

0.30000.3000-0.4000

4.Givetheanswerofthefollowingoperations

a=2-2b=1-1c=1d=eye

(2)

-12022

1)a+b2)a*d3)a.*d4)a*c

5)a.*c6)a\b7)a.\b8)a.^b

1)31

-14

2)22

-12

3)20

02

4)6

3

5)维数不一致

6)0.3333-1.0000

0.16670.5000

7)0.5000-0.5000

01.0000

8)2.00000.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)

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.Writeoutm.fileandplotthefigureswithgrids

Assumethatthecomplexfunctionf(t)isdefinedbytheequation

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

Plottheamplitudeandphaseoffunctionfor

t=0:

0.1:

4;

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

plot(t,abs(f),'*',t,abs(f));

figure

plot(t,angle(f)*180/pi,'*',t,angle(f)*180/pi)

2.WritetheMatlabstatementsrequiredtocalculatey(t)fromtheequation

forvalueoftbetween–9and9instepsof0.5.Useloopsandbranchestoperformthiscalculation.

 

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

MATLAB实验四

一、实验目的:

1.LearntowriteMATLABfunctions

2.Befamiliarwithcomplexdataandcharacterdata

3.Practice2Dplotting

二、实验内容:

1.WritethreeMatlabfunctionstocalculatethehyperbolicsine,cosine,and

tangentfunctions:

thenplottheshapesofhyperbolicsine,cosine,andtangentfunctionsononefigure,

.

答案x=-5:

0.5:

5;

y1=sih1(x);

y2=coh1(x);

y3=tah1(x);

plot(x,y1,'p',x,y2,'r',x,y3,'*');

xlabel('x');

legend('sinh(x)','cosh(x)','tanh(x)');

gridon

/*functionsi=sih1(x)

si=(exp(x)-exp(-1*x))/2;

return

functionco=coh1(x)

co=(exp(x)+exp(-1*x))/2;

return

functionta=tah1(x)

ta=(exp(x)-exp(-1*x))./(exp(x)+exp(-1*x));

return

*/

2.Writeaprogramusethefunction

andplottheline,

andsearchfortheminimumandmaximumin200stepsovertherangeof

marktheminimumandmaximumonthelinefigure.

 

3.Writeafunctiontocalculatethedistancebetweentwopoints

and

thatthepointsshouldbegivenby‘input’function.

4.Writeafunctioncomplex_tothatacceptacomplexnumbervar,andreturnstwooutputargumentscontainingthemagnitudemagandanglethetaofthecomplexnumber.Theoutputangleshouldbeindegrees.

Writeanotherfunctionpolar_to_complexthatacceptstwoinputargumentscontainingthemagnitudemagandanglethetaofthecomplexnumberindegrees,andreturnsthecomplexnumbervar.

4.Writeaprogramthatacceptsaseriesofstringsfromauserwiththeinputfunction,sortsthestringsintoascendingorder,andprintsthemout.

MATLAB实验五

一、实验目的:

1.LearntowriteMATLABfunctions

2.Befamiliarwithcomplexdataandcharacterdata

5.Practice2Dplotting

二、实验内容:

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.

MATLAB实验六

一、实验目的:

1.Practice2Dplottingand3Dplotting

2.Learntousefplotfunction

3.Befamiliarwithcellarraysandstructurearrays

二、实验内容:

1.Givethe3Dplotfigureof

useplot3function,

andgridon,linewidthis3.0.

2.Plotthefunction

step0.1.Createthefollowingplottypes:

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

3.Plotthefunction

overtherange

usingfunctionfplot,andgridon.

4.Createacellarrays:

5.Createastructurearraysandtocalculatethemeanbillingofthreepatients:

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.Writeaprogramtoreadasetofintegersfromaninputdatafile,andlocatethelargestandsmallestvalueswithinthedatafile.Printoutthelargestandsmallestvalues,togetherwiththelinesonwhichtheywerefoundinonefigure.

MATLAB实验八

一、实验目的:

1.Befamiliarwithhandlegraphics

2.LearnaboutGUI

3.LearntodesignPIDcontrolsystemwithSimulink

二、实验内容:

1.SecondOrderSystemGUIDesign

%SOSystem_GUI.m

set(gcf,'defaultuicontrolunits','normalized');

set(gcf,'defaultuicontrolfontsize',12);

str='SecondOrderSystemStepresponse';set(gcf,'name',str);

h_axes=axes('position',[0.05,0.2,0.6,0.7]);set(h_axes,'xlim',[0,15]);

str1='ZETA=';

t=0:

0.1:

10;z=0.5;y=step(1,[12*z1],t);

hline=plot(t,y);gridon;

htext=uicontrol(gcf,'style','text','position',[0.67,0.8,0.33,0.1],'strin

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

当前位置:首页 > 总结汇报 > 学习总结

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

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