实验一
第7题程序:
R1=2;R2=4;R3=12;R4=4;R5=12;R6=4;R7=2;
A=[R1+R2+R3,-R3,0;-R3,R3+R4+R5,-R5;0,-R5,R5+R6+R7];
B=[1;0;0];
us=10;
I=A\B*us;
ia=I(1);ib=I(2);ic=I(3);
i3=ia-ib
第8题程序:
t=-pi:0.01:pi;
n=1;
i=0;
while n<=10
i=i+0.88*n*t.*exp(-n*abs(t))
n=n+1;
end
plot(t,i,'r-o')
xlabel('t','FontSize',12);
ylabel('i(t)','FontSize',12);
第9题程序:
① 使用surf函数:
a=-8;
b=8;
x=linspace(a,b,30);
y=linspace(a,b,30);
[xx,yy]=meshgrid(x,y);
zz=sin(sqrt(xx.^2+yy.^2))./sqrt(xx.^2+yy.^2);
surf(xx,yy,zz)
② 使用mesh函数:
a=-8;
b=8;
x=linspace(a,b,30);
y=linspace(a,b,30);
[xx,yy]=meshgrid(x,y);
zz=sin(sqrt(xx.^2+yy.^2))./sqrt(xx.^2+yy.^2);
mesh(xx,yy,zz)
第10题程序:
① function f(a,b)
x=linspace(a,b,30);
y=linspace(a,b,30);
[xx,yy]=meshgrid(x,y);
zz=sin(sqrt(xx.^2+yy.^2))./sqrt(xx.^2+yy.^2);
surf(xx,yy,zz)
② function g(a,b)
x=linspace(a,b,30);
y=linspace(a,b,30);
[xx,yy]=meshgrid(x,y);
zz=sin(sqrt(xx.^2+yy.^2))./sqrt(xx.^2+yy.^2);
mesh(xx,yy,zz)
第11题程序:
figure
h_menu=uimenu('label','Option','Position',3);
h_sub1=uimenu(h_menu,'label','grid on','callback','grid on');
h_sub2=uimenu(h_menu,'label','grid off','callback','grid on');
h_sub3=uimenu(h_menu,'label','box on','callback','box on',...
'separator','on');
h_sub4=uimenu(h_menu,'label','box off','callback','box off');
h_sub5=uimenu(h_menu,'label','Figure Color','Separator','on');
h_subsub1=uimenu(h_sub5,'label','Red','ForeGroundColor','r',...
'callback','set(gcf,''Color'',''r'')');
h_subsub2=uimenu(h_sub5,'label','Reset',...
'callback','set(gcf,''Color'',''w'')');
第二篇:武汉工程大学实验报告03
计算机科学与工程学院
《算法与数据结构》实验报告(三)