Professional Documents
Culture Documents
Engineers
姓名:户桂民
学号:06030229
班级:0290601
日期:2008/05/11
One:objectives
Two :contents
temp=input('input a number:');
if temp >103.0
disp('Temperature dangerousely high');
elseif temp >99.5
disp('Temperature slightly high');
elseif temp >=97.5
disp('Temperature normal');
else
disp('Temperature below normal');
end
2
>> hu2
input a number:3
Temperature below normal
>> hu2
input a number:100
Temperature slightly high
>> hu3
input the weight of the package in pounds:100
Cost:275.00 dollars
>> hu3
input the weight of the package in pounds:50
Cost:190.00 dollars
x=input('input x:');
y=input('input y:');
if x>=0
if y>=0
funxy=x+y;
else
funxy=x+y^2;
end
else
if y>=0
funxy=x^2+y;
else
3
funxy=x^2+y^2;
end
end
fprintf('f(x,y)=%10.2f',funxy);
>> hu4
input x:5
input y:6
f(x,y)= 11.00
x=input('input x(x<1):');
if x<1
y=log(1/(1-x));
fprintf('y(%f)=%f',x,y);
else
fprintf('Error input')
end
>> hu5
input x(x<1):0.2
y(0.200000)=0.223144
r=16000;
c=1.0e-6;
subplot(2,1,1);
f=1:2:1000;
v_oi=abs(j*2*pi*r*c*f./(1+j*2*pi*f*r*c));
loglog(f,v_oi);
title('Amplitude response');
xlabel('frequence(HZ)');
ylabel('Ouput/Input ratio');
grid on
subplot(2,1,2);
ff=1:2:1000;
phase_oi=angle(j*2*pi*r*c*ff./(1+j*2*pi*ff*r*c));
semilogx(ff,phase_oi);
title('Phase response');
4
xlabel('frequence(HZ)');
ylabel('Ouput-Input phase(rad)');
grid on
k=0.5
theta=0:0.1:6*pi;
r=k.*theta;
x=r.*cos(theta);
y=r.*sin(theta);
plot(x,y);
grid on
xlabel('X');
ylabel('Y');
title('The Spiral of Archimedes');
5
Three: Experience