预览加载中,请您耐心等待几秒...
1/6
2/6
3/6
4/6
5/6
6/6

在线预览结束,喜欢就下载吧,查找使用更方便

如果您无法下载资料,请参考说明:

1、部分资料下载需要金币,请确保您的账户上有足够的金币

2、已购买过的文档,再次下载不重复扣费

3、资料包下载后请先用软件解压,在使用对应软件打开

Experiment1BasicOperationofMatlab1.UsetheMatlabEditWindowtocreateanewemptyM-file,typethesestatementsintothefile,andsavethefilewiththenameget_sin.m.Thenexecutetheprogrambytypingthenameget.sininthecommandwindow.Whatresultdoyouget?%get_sin.m:Thism-filecalculatesandplotsthe%functionsin(x)for0<=x<=6.x=0:0.1:6;y=sin(x);plot(x,y);2.Createanewm-filenamedcalc_area.mandtypethestatementsintothefile.%Thism-filecalculatestheareaofacircle,%anddisplaystheresult.radius=2.5;area=pi*2.5^2;string=['Theareaofthecircleis'num2str(area)];disp(string);(1)whatresultdoyouget?Theareaofthecircleis19.635(2)UsetheWorkspaceBrowsertodeterminewhatvariablesaredefinedinthecurrentworkspace.Area;19.634954084936208Radius:2.5String:Theareaofthecircleis19.635AssumethatarraycisdefinedasshownGetthesizeofc.a=siza(c)34Givetheresultofsum(A).clearc=[1.1-3.23.40.6;0.61.1-0.63.1;1.30.65.50.0];b=0;fori=1:3forj=1:4b=b+c(i,j);endendbb=13.5000sum(A)=13.50(3)determinethecontentsofthefollowingsubarrays:a1=c(2,:)a2=c(:,end)a3=c(1:2,2:end)a4=c(6)a5=c(4:end)a6=c(1:2,2:4)a7=c([14],2)a8=c([22],[33])a1=c(2,:)a2=c(:,end)a3=c(1:2,2:end)a4=c(6)a5=c(4:end)a6=c(1:2,2:4)a7=c([14],2)a8=c([22],[33])a1=0.60001.1000-0.60003.1000a2=0.60003.10000a3=-3.20003.40000.60001.1000-0.60003.1000a4=0.6000a5=Columns1through6-3.20001.10000.60003.4000-0.60005.5000Columns7through90.60003.10000a6=-3.20003.40000.60001.1000-0.60003.1000???Indexexceedsmatrixdimensions.a8=c([22],[33])a8=-0.6000-0.6000-0.6000-0.60004ThedistancetravelledbyaballfallingintheairisgivenbytheequationUseMatlabtocalculatethepositionoftheballattimet=5sif,,and.Giveyourresult.x=-37.6250Giveresultofthefollowingstatements:Z=zeros(2,4)F=5*ones(3,3)N=fix(10*rand(1,10))R=randn(4,4)Z=zeros(2,4)F=5*ones(3,3)N=fix(10*rand(1,10))R=randn(4,4)Z=00000000F=555555555N=9264874084R=-0.4326-1.14650.3273-0.5883-1.66561.19090.17462.18320.12531.1892-0.1867-0.13640.2877-0.03760.72580.1139Sol