Problem #1:吳堉光
題旨:操作使用MATLAB
程式流程和程式內容
% Problem #1
clear all
% Question 1
f=200; d=20; t=60; % f = force, d =distance, t = time
j=0.101972;
p=f*d/j/t;
fprintf('%s%s%f\n','Question#1: ','Power is ',p);
% Question 2
clear all
R1=1;R2=10;R3=100; % three resistors
R=R1+R2+R3;
V=110; % V is volt
i=V/R; % i is current
w=i*V; % w is power consumption
fprintf('%s%s%f%s%f\n','Question#2: ','Current is ',i,'; Power consuption is ',w)
% Question 3
clear all
a=650; b=428; c=282;
s=(a+b+c)/2;
a=sqrt(s*(s-a)*(s-b)*(s-c)); % Heron formatiom
fprintf('%s%s%f\n','Question#3: ','The area of trangle is ',a)
% Question 4
clear all
x=(52000+84300-25000)/600; % x is the number of hogs
fprintf('%s%s%f\n','Question#4: ','The number of hogs is ',x)
% Question 5
clear all
L=4; H=0.9;
Q=3.33*(L-0.2*H)^(3/2);
fprintf('%s%s%f\n','Question#5: ','The flow rate is ',Q)
執行結果及討論
Question#1: Power is 653.774239
Question#2: Current is 0.990991; Power consuption is 109.009009
Question#3: The area of trangle is 45233.155981
Question#4: The number of hogs is 185.500000
Question#5: The flow rate is 24.862184
沒有留言:
張貼留言