De Xuan Vo Lab Assignment No. 5
De Xuan Vo Lab Assignment No. 5
Chapter 1
T1.1-1
a.
>> 6*(10/13)+18/(5*7)+5*9^2
ans =
410.1297
b.
>> 6*(35^(0.25))+14^0.35
ans =
17.1123
T1.3-3
>> t=0:0.01:5;
>> s=2*sin(3*t+2)+sqrt(5*t+1);
>> plot(t,s),xlabel('Time (s)'),ylabel('Speed(ft/s)'),title('Speed vs. Time')
De Xuan Vo
Lab Assignment No. 5
T1. 3-4
>> x=0:0.01:1.5;
>> y=4*sqrt(6*x+1);
>> z=5*exp(0.3*x)-2*x;
>> plot(x,y,x,z),xlabel('Distance (m)'),ylabel('Force (N)'),gtext('y'),gtext('z')
De Xuan Vo
Lab Assignment No. 5
T1. 3-5
>> A=[6,-4,8;-5,-3,7;14,9,-5];
>> B=[112;75;-67];
>> Solution =A\B
Solution =
2.0000
-5.0000
10.0000
Section 1.1
Problem 12
>> P=2.2;
>> T1=-15+273.2;
>> V1=28500;
>> Rn=P*V1/T1
Rn =
242.8350
>> T2=31+273.2;
>> V2=Rn*T2/P
V2 =
3.3577e+04
De Xuan Vo
Lab Assignment No. 5
Section 1.3
Problem 13
>> m=sin(-pi/2):0.05:cos(0);
>> length(m)
ans =
41
>> m(10)
ans =
-0.5500
Section 1.3
Problem 18
>> y=[13,182,-184,2503];
>> roots(y)
ans =
-15.6850
0.8425 + 3.4008i
0.8425 - 3.4008i
De Xuan Vo
Lab Assignment No. 5
Section 1.3
Problem 22
>> x=0:0.01:2;
>> u=2*log10(60*x+1);
>> v=3*cos(6*x);
>> plot(x,u,x,v),xlabel('Distance (Miles)'),ylabel('Speed (mph)'),gtext('u'),gtext('v')
De Xuan Vo
Lab Assignment No. 5
Chapter 2
Section2.1
Problem 1
a.
>> x1=linspace(5,28,100)
>> x2=5:0.2323:28
b.
>> x3=2:0.2:14
>> x4=linspace(2,14,61)
c.
>> x5=linspace(-2,5,50)
>> x6=-2:0.1429:5
De Xuan Vo
Lab Assignment No. 5
Section2.1
Problem 10
a.
>> B(2,:)
b.
>> sum(B(2,:))
c.
>> x=B(:,2);
>> y=A(:,1);
>> c=x.*y
d.
>> [m,n]=max(x.*y)
e.
>> x=A(1,:);
>> y=B(1:3,3);
>> d=x./y';
>> sum(d)
ans =
3.3391
De Xuan Vo
Lab Assignment No. 5
Section 2.3
Problem 12
a.
>> A+B+C
ans =
-6 -3
23 15
b.
d.
>> A-B+C
>> A+B+C
ans =
ans =
7
-6
-3
19
23
15
-14
-1
c.
>> B+C+A
>> (A+B)+C
ans =
ans =
-6
-3
-6 -3
23
15
23
>> A+C+B
15
>> A+(B+C)
ans =
ans =
-6
-3
-6 -3
23
15
23
15
De Xuan Vo
Lab Assignment No. 5
Section2.3
Problem 13
>> A=[56,32;24,-16];
>> B=[14,-4;6,-2];
a.
>> A*B
ans =
976 -288
240 -64
b.
>> A\B
ans =
0.2500 -0.0769
0
0.0096
c.
>> B.^3
ans =
2744
-64
216
-8
De Xuan Vo
Lab Assignment No. 5
Section2.3
Problem 16
>> wage=[5,5.5,6.5,6,6.25];
e.
>> hours=[40,43,37,50,45];
>> sum(hours)/sum(widgets
ans =
a.
0.0398
>>
widgets=[1000,1100,1000,1200,1100];
>> sum(widgets) % number of widgets
ans =
5400
d.
27.0270
n=
3
% Worker 3 is the most efficient
>> [a,b]=min(efficiency)
a=
24
b=
4
% Worker 4 is the lest efficient.
De Xuan Vo
Lab Assignment No. 5
Section2.3
Problem 18
0.0117
0.0089
0.0077
0.0129
b.
>> potential=0.5*(Springconstant.*(compression.^2))
potential =
0.0605
0.0408
0.0356
0.0385
0.0579
De Xuan Vo
Lab Assignment No. 5
Section2.3
Problem 23
a.
>>k=0.047:0.001:0.107; % (1/hr)
>> t=-(log(0.5)./k); % This is the expression for half life in term of k.
>> plot(t,k),xlabel('Time (hr)'),ylabel('Rate Constant (1/hr)')
De Xuan Vo
Lab Assignment No. 5
Section2.3
Problem 23
b.
>> t=linspace(0,1,61);
>> k=0.047:0.001:0.107;
>> a=1;
>> C=(1./k).*(1-exp(-k.*t));
>> plot(k,C),xlabel('Rate Constant (1/hr)'),ylabel('Concentraion')
De Xuan Vo
Lab Assignment No. 5
Section2.4
Problem 26
>> A=[4,-2,1;6,8,-5;7,9,10];
>> B=[6,9,-4;7,5,3;-8,2,1];
>> C=[-4,-5,2;10,6,1;3,-9,8];
a.
b.
>> A*(B+C)
>> (A*B)*C
ans =
ans =
-31 -13
-7
209
347
-136
297
-111
308
117
1207
562
250
209
347
-136
297
-111
308
117
1207
562
250
57 112
>> A*B+A*C
>> A*(B*C)
ans =
ans =
-31 -13
-7
57 112
De Xuan Vo
Lab Assignment No. 5
Section2.5
T2. 5-1
a.
>> y=[1,13,52,6];
>> x=roots(y)
x=
-6.4406 + 2.9980i
-6.4406 - 2.9980i
-0.1189
>>% Check with poly function
>> poly(x)
ans =
1.0000 13.0000 52.0000
6.0000
De Xuan Vo
Lab Assignment No. 5
Section2.5
T2. 5-5
>> x=-7:0.01:1;
>> y=polyval([1,13,52,6],x);
>> plot(x,y),xlabel('x'),ylabel('y')