EX CHAP 4
subplot(1,2,1)
hold on
x=-2.5:0.2:2.5;
f=-2*exp(x)+3*x;
plot(x,f,'b--')
hold on
x=2:0.5:10;
g=sqrt(x.^2-3);
plot(x,g,'g:')
grid on
subplot(1,2,2)
hold on
x=1:20;
h=(-3*x.^2-2*x+4)/(3*x-1);
plot(x,h,'b-')
hold on
x=1:0.1:4;
k=log(x)+4;
plot(x,k,'kh')
grid on
TD02
A=[1 2 ; 7 2]
A =
1 2
7 2
>> B=[3 -2 ; 0 1]
B =
3 -2
0 1
>> C=[-1 3 ; 0 1 ; -1 -1 ; 4 8]
C =
-1 3
0 1
-1 -1
4 8
>> A*B-3
ans =
0 -3
18 -15
>> C*B+1+zeros(4,2)
ans =
-2 6
1 2
-2 2
13 1
>> C(1:2,:)^2
ans =
1 0
0 1
>> A.*B-3
ans =
0 -7
-3 -1
>> A'.^B/2
ans =
0.5000 0.0102
0.5000 1.0000
>> C(2:3,:).^2
ans =
0 1
1 1
>> A^2-ones (2)
ans =
14 5
20 17
>> C*eye(2)
ans =
-1 3
0 1
-1 -1
4 8
>> C(end:-1:1,2).\24
ans =
3
-24
24
8