8
7
6
5
4
3
2
1
20
21
22
23
24
25
>>Figure (2)
>> x=1:8; y=[20 22 25 30 28 25 24 22];
>> plot(x,y)
26
27
28
29
30
30
29
28
27
26
25
24
23
22
21
20
>>Figure (3)
>> y=x.^3;
>> plot(x,y)
>> xlabel('sumbu X'), ylabel('sumbu Y')
>> title('kurva Y=X^3')
>> grid on
kurva Y=X3
30
20
sumbu Y
10
-10
-20
-30
-3
-2
-1
0
sumbu X
>>Figure (4)
>> x=linspace(0,5,500);
>> y1=exp(-x); plot(x,y1);
>> grid on
>> hold on
>> y2=exp(-0.5*x); plot(x,y2);
>> y3=exp(-0.25*x); plot(x,y3);
>> y4=exp(-0.1*x); plot(x,y4);
>> xlabel('sumbu-x'), ylabel('sumbu-y')
>> title('Perbandingan fungsi eksponensial negatif')
1
0.9
0.8
0.7
sumbu-y
0.6
0.5
0.4
0.3
0.2
0.1
0
0.5
1.5
>>Figure (5)
>> x=1:10;
>> y=20:29;
>> subplot(2,2,1);plot(x,y);
>> subplot(2,2,2);plot(y,x);
>> subplot(2,2,3);plot(x.^2,y);
>> subplot(2,2,4);plot(x.^2,y.^2);
2.5
sumbu-x
3.5
4.5
30
10
28
26
24
22
20
0
20
10
30
900
28
800
26
700
24
600
22
500
20
50
400
100
>>figure (6)
>> x=1:10
x=
>> y1=2.*x.^2+2;
>> y2=x.^3-x.^2;
>> y3=2.*x+1;
>> y4=x.^2+2.*x;
>> subplot(2,2,1);plot(x,y1);
>> subplot(2,2,2);plot(x,y2);
10
25
30
50
100
>> subplot(2,2,3);plot(x,y3);
>> subplot(2,2,4);plot(x,y4)
250
1000
200
800
150
600
100
400
50
200
10
25
10
10
150
20
100
15
10
50
5
0
>>Figure (7)
>> x=1:10;
>> y1=2*(x.^2+2);
>> y2=(x.^3-3)./(x.^2);
>> y3=(2.*x.^2-2)./(2.*x);
>> y4=(x.^3-2.*x.^2)./(x.^2);
>> subplot(2,2,1);plot(x,y1);
>> subplot(2,2,2);plot(x,y2);
>> subplot(2,2,3);plot(x,y3);
>> subplot(2,2,4);plot(x,y4);
10
250
10
200
5
150
100
50
0
10
-5
10
>>figure (8)
>> x1=1:10;
>> y1=2.*x1;
>> x2=-5:5;
>> y2=x2.^2;
>> x3=5:15;
>> y3=x3.^2+2.*x3;
>> plot(x1,y1,x2,y2,x3,y3)
10
-2
10
10
300
250
200
150
100
50
0
-5
>>figure (9)
>> x1=1:10;
>> y1=2.*x1;
>> x2=-5:5;
>> y2=x2.^2;
>> x3=5:15;
>> y3=x3.^2+2.*x3;
>> plot(x1,y1,'k--x',x2,y2,'k--*',x3,y3,'k--d')
>> axis([-5 15 -5 20])
10
15
20
15
10
-5
-5
>>figure (10)
>> x=linspace(0,5,500);
>> y1=exp(-x); y2=exp(-0.5*x); y3=exp(-0.25*x);
>> y4=exp(-0.1*x);
>> plot(x,y1,x,y2,x,y3,x,y4)
>> grid on
>> xlabel('sumbu-x'), ylabel('sumbu-y')
>> title('kurva y = exp(-Ax)')
>> legend('A=1','A=0.5','A=0.25','A=0.1')
10
15
kurva y = exp(-Ax)
A=1
A=0.5
A=0.25
A=0.1
0.9
0.8
0.7
sumbu-y
0.6
0.5
0.4
0.3
0.2
0.1
0
0.5
1.5
2.5
sumbu-x
3.5
>>figure (11)
>> x=linspace(0,5,500);
>> y1=exp(-x); y2=exp(-0.5*x); y3=exp(-0.25*x);
>> y4=exp(-0.1*x);
>> plot(x,y1,x,y2,x,y3,x,y4)
>> grid on
>> xlabel('sumbu-x'), ylabel('sumbu-y')
>> title('kurva y = exp(-Ax)')
>> legend('A=1','A=0.5','A=0.25','A=0.1')
>> figure
>> semilogy(x,y1,x,y2,x,y3,x,y4)
>> grid on
>> xlabel('sumbu-x'), ylabel('sumbu-y')
4.5
sumbu-y
10
A=1
A=0.5
A=0.25
A=0.1
-1
10
-2
10
0.5
1.5
2.5
sumbu-x
>>figure (12)
>> t=0:0.5:10;
>> sinus=sin(2*pi*0.25*t);
>> cosinus=cos(2*pi*0.25*t);
>> kotak=square(2*pi*0.25*t);
>> gigi=sawtooth(2*pi*0.25*t);
>> subplot(2,2,1);
>> plot(t,sinus), title('sinus1/4 Hz')
>> subplot(2,2,2);
>> plot(t,cosinus), title('cosinus 1/4 Hz')
3.5
4.5
>> subplot(2,2,3);
>> plot(t,kotak), title('kotak 1/4 Hz')
>> subplot(2,2,4);
>> plot(t,gigi), title('gigi gergaji 1/4 Hz')
sinus1/4 Hz
1
0.5
0.5
-0.5
-0.5
-1
10
kotak 1/4 Hz
-1
0.5
-0.5
-0.5
0
>>figure (13)
>> x=linspace(-6,6,100);
>> y=x.^4-9.*x.^2;
>> figure; plot(x,y);
>> grid on
>> xlabel('x'), ylabel('y')
10
-1
10
0.5
-1
cosinus 1/4 Hz
10