青岛大学matlab-E1.docx

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

MATLAB 实验一
一、实验目的:
1. Be familiar with MATLAB Environment
2. Be familiar with array and matrix
3. Be familiar with MATLAB operations and simple plot function
二、实验内容:
1. Be familiar with Matlab 6.5
Startup Matlab 6.5, browse the major tools of the Matlab desktop ⏹ The Command Windows
⏹ The Command History Windows
⏹ Launch Pad
⏹ The Edit/Debug Window
⏹ Figure Windows
⏹ Workspace Browser and Array Editer
⏹ Help Browser
⏹ Current Directory Browser
2. Give the answer of the following questions for the array
1.10.0
2.1
3.5 6.00.0 1.1 6.6 2.8 3.41 2.10.10.30.4 1.31.4 5.1
0.0 1.10.0array -⎡⎤⎢⎥-⎢⎥=⎢⎥-⎢⎥-⎣⎦ 1)What is the size of array1?
s=size(array1);s= 4 5
2)What is the value of array1(4,1)?
a=array1(4,1); a=-1.4000
3)What is the size and value of array1(:,1:2)?
b=size(array1(:,1:2)); b= 4 2
c=array1(:,1:2);
4) What is the size and value of array1([1 3], end)? d=size(array1([1 3],end));d= 2 1
e=array1([1 3],end);
3. Give the answer of the following commad
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’]
4. Give the answer of the sub -arrays
1.10.0
2.1
3.5 6.00.0 1.1 6.6 2.8 3.41 2.10.10.30.4 1.31.4 5.10.0 1.10.0array -⎡⎤⎢⎥-⎢⎥=⎢⎥-⎢⎥-⎣⎦
1) array1(3,:);
2) array1(:,3); 3) array1(1:2:3,[3 3 4])
4) array1([1 1],:)
5. Give the answer of the following operations
22111,,,(2)12022a b c d eye --⎡⎤⎡⎤
⎡⎤
====⎢⎥⎢⎥⎢⎥--⎣⎦⎣⎦⎣⎦
1) a+b 2) a*d 3) a.*d
4) a*c 5) a.*c 6)a\b
7) a.\b 8)a.^b
6.Solve the following system of simultaneous equations for x
1234561234561234561234561234562.0 5.0 1.0 3.0 4.0 1.00.0
2.0 1.0 5.0 2.0 6.0 4.0 1.0
1.0 6.0 4.0 5.0 3.0 1.0 6.0
4.0 3.0 6.0
5.0 2.0 2.010.0
3.0 6.0
4.0 2.0 6.0 4.06x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x -++++-=---++=-+--+-=--+----=-+++-+=-123456.0
2.0 4.0 4.0 4.0 5.0 4.0 2.0
x x x x x x ⎧⎪⎪⎪⎪⎨⎪⎪⎪++++-=-⎪⎩
a=[-2 5 1 3 4 -1;2 -1 -5 -2 6 4;-1 6 -4 -5 3 -1;... -4 3 -6 -5 -2 -2;-3 6 4 2 -6 4;2 4 4 4 5 -4] b=[0;1;-6;10;-6;-2]
x=a'*b; c=x ’;
7.Edit & Run the m -file
% test step response function
wn=6; kosi=[0.1:0.1:1.0 2];
figure(1); hold on
for kos=kosi
num=wn^2; den=[1,2*kos*wn,wn.^2]; step(num,den)
end
hold off;
8.Edit & Run the m-file
% test plot function
x=0:pi/20:3*pi; y1=sin(x); y2=2*cos(2*x); plot(x,y1,'rv:',x,y2,'bo--');
title('Plot the Line of y=sin(2x) and its derivative'); xlabel('X axis'); ylabel('Y axis');
legend('f(x)','d/dx f(x)'); grid on;
9.Edit & Run the m-file
% test subplot and loglog function
x=0:0.1:10; y=x.^2-10.*x+26;
subplot(2,2,1); plot(x,y); grid on;
subplot(2,2,2); semilogx(x,y); grid on;
subplot(2,2,3); semilogy(x,y); grid on;
subplot(2,2,4); loglog(x,y); grid on;
10.Edit & Run the m-file
% test max and plot function
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'); grid on;。

相关文档
最新文档