You are on page 1of 28

TUGAS I

PIRANTI LUNAK TELEKOMUNIKASI

PEBRI YENI SAMOSIR

(1404405097)

JURUSAN TEKNIK ELEKTRO DAN KOMPUTER


FAKULTAS TEKNIK
UNIVERSITAS UDAYANA
2016

1.

(P.2.3) Evaluate the following expressions using the MATLAB arithmetic hierarchy
expressed with a minimum number of parenthesis.
a. 25/(26-1)
Syntax :
>> 2^5/(2^6-1)
Hasil Run Program (Tampilan Command Window ) :

b. e4
Syntax :
>> (exp (4))
Hasil Run Program (Tampilan Command Window ) :

c. ln(e4)

Syntax :
>> log (exp(4))
Hasil Run Program (Tampilan Command Window ) :

d. log 10 (e4)
Syntax :
>> log10(exp(4))
Hasil Run Program (Tampilan Command Window ) :

e.

e 121

Syntax :

>> exp(pi*sqrt(121))
Hasil Run Program (Tampilan Command Window ) :

f. cos ( /4 ) + sin2 ( /3 )

Syntax :
>> cos(pi/4)+sin(pi/3)^2
Hasil Run Program (Tampilan Command Window ) :

g. Loge(e3) + log10(e)
Syntax :
>> log (exp (3))+ log10 (exp (1));

Hasil Run Program (Tampilan Command Window ) :

h. Area = ( /3)

Syntax :
>> area = pi*(pi/3)^2
Hasil Run Program (Tampilan Command Window ) :

2. (P.2.4) Solve for x each of the equations given below.


a. 2x = 7
Syntax :
>> solve 2^x=7
ans =
log(2, 7)
>> log(7)/log(2)
ans =
2.8074
Hasil Run Program (Tampilan Command Window ) :

b. ln(x) = 3
Syntax :
>> solve log(x)=3
ans =
exp(3)
>> (exp (3))
ans =
20.0855
Hasil Run Program (Tampilan Command Window ) :

c. ex = 10
Syntax :
>> solve exp(x)=10
ans =
log(10)
>> log (10)
ans =
2.3026
Hasil Run Program (Tampilan Command Window ) :

d.

e.

1
3
)x
1/ 3
1 /3
3 . 9 =
Syntax :
>> solve sqrt(3^(1/3)*9^(1/3))=(1/3)^x
ans =
-log((3^(1/3)*9^(1/3))^(1/2))/log(3)
>> -log((3^(1/3)*9^(1/3))^(1/2))/log(3)
ans =
-0.5000
Hasil Run Program (Tampilan Command Window ) :

2 =3 x
63

Syntax :
>> solve sqrt(2)/6^3=3^x
ans =
-log(3, 108*2^(1/2))
>> -log(108*2^(1/2))/log(3)
ans =
-4.5773
Hasil Run Program (Tampilan Command Window ) :

3. (P.2.25) Three points given in terms of the Cartesian coordinates system define a triangle,
write a program to compute the area of the triangle if the vertex points are given by the
following points:
P1 (1,1), P2 (2,4) and P3 (3,2)
Note that the distance between two points, P 1 (X1 , Y1) and P2 (X2,Y2), in terms of its
coordinates is given by
2
Y 1 Y 2
X 1 X 2 2+
Distance =

Syntax :

Hasil Run Program (Tampilan Command Window ) :

4. (P.2.26) Two Cartesian coordinates point are given by P0(X0,Y0) and P1(X1,Y1), then the slope
of the line passing through these points is given by
Y 1Y 0
Slope = X 1X 0
Using MATLAB, compute the slope and distance for the following set of points:
a. P0(5, 1);P1(3, 2)
b. P0(8, 1);P1(9, 0)
c. P0(5, 3);P1(1, 7)
a. P0 (5,-1); P1(3,2)
Syntax :
>> px0=5;py0=-1;px1=3;py1=2;
>> slope =(py1-py0)/(px1-px0)
slope =
-1.5000
Hasil Run Program (Tampilan Command Window) :

b. P0 (8,-1); P1(9,0)
Syntax :
>> px0=8;py0=1;px1=9;py1=0
py1 =
0
>> slope = (py1-py0)/(px1-px0)
slope =
-1
Hasil Run Program (Tampilan Command Window) :

c. P0 (5,3); P1(-1,7)
Syntax :
>> px0=5;py0=3;px1=-1;py1=7
py1 =
7
>> slope =(py1-py0)/(px1-px0)
slope =
-0.6667
Hasil Run Program (Tampilan Command Window) :

5. (P.2.37) The population in the United States after 1980 can be approximate by thhe following
equation:
P(n) =227e0,007n
Where n represents the number of years after 1980. Estimates the population in the Unites
States in
a. 2010
b. 2020
c. 2050
a. 2010
Syntax :
>> N= 2010-1980
N = 30
>> P30=227*exp(0.007*30)
P30 =
280.0449
Hasil Run Program (Tampilan Command Window):

b. 2020
Syntax :
>> N =2020-1980
N = 40
>> P40=227*exp(0.007*40)
P40 =
300.3505
Hasil Run Program (Tampilan Command Window):

c. 2050
Syntax :
>> N = 2050-1980

N = 70
>> P70=227*exp(0.007*70)
P70 =
370.5358
Hasil Run Program (Tampilan Command Window):

6. (P.3.2) Let x = 1:10. Evaluate the following commands:


a. xx
b. x.^x
c. x. * x
d. x * x
e. x * x
f. x.\ x
g. x./x
h. x = x
7. (R.3.63) Matrix A is an orthogonal matrix, if A is square matrix that possesses an inverse that
satisfies the following relation: inv(A) = AT, or its equivalent relation ATA =AAT= I. Observe
that matrix A is orthogonal if its rows or columns form an orthonormal system.
8. (R.3.64) For example, verify that matrix A, defined as follows, constitutes an orthogonal
matrix for any value of x :
cos ( x) sin ( x )
A = [ sin ( x) cos ( x )
Let us test orthogonality over te range 0 x 4 , using five linearly spaced points, by
writing thhe script file:orthodonal.
Answer 7 and 8 :
Syntax :
>> x=[0:0.5:4]*pi
x=
0 1.5708 3.1416

4.7124

6.2832

7.8540

9.4248 10.9956 12.5664

>> A1= [ cos (x(1)) -sin(x(1));sin(x(1)) cos (x(1))]


A1 =
1 0
0 1
>> a1=A1'
a1 =
1 0
0 1
>> A11=A1.*a1
A11 =
1 0
0 1
>> A11=a1.*A1
A11 =
1 0
0 1
>> A2=[cos(x(2)) -sin(x(2));sin(x(2)) cos(x(2))]
A2 =
0.0000 -1.0000
1.0000 0.0000
>> a2=A2'
a2 =
0.0000 1.0000
-1.0000 0.0000
>> A22=A2.*a2
A22 =
0.0000 -1.0000
-1.0000 0.0000
>> A22=a2.*A2
A22 =
0.0000 -1.0000
-1.0000 0.0000
>> A3=[cos(x(3)) -sin(x(3));sin(x(3)) cos(x(3))]
A3 =
-1.0000 -0.0000
0.0000 -1.0000
>> a3=A3'

a3 =
-1.0000 0.0000
-0.0000 -1.0000
>> A33=A3.*a3
A33 =
1.0000 -0.0000
-0.0000 1.0000
>> A33=a3.*A3
A33 =
1.0000 -0.0000
-0.0000 1.0000
>> A4=[cos(x(4)) -sin(x(4));sin(x(4)) cos(x(4))]
A4 =
-0.0000 1.0000
-1.0000 -0.0000
>> a4=A4'
a4 =
-0.0000 -1.0000
1.0000 -0.0000
>> A44=a4.*A4
A44 =
0.0000 -1.0000
-1.0000 0.0000
>> A44=A4.*a4
A44 =
0.0000 -1.0000
-1.0000 0.0000
>> A5=[cos(x(5)) -sin(x(5));sin(x(5)) cos(x(5))]
A5 =
1.0000 0.0000
-0.0000 1.0000
>> a5=A5'
a5 =
1.0000 -0.0000
0.0000 1.0000
>> A55=a5.*A5

A55 =
1.0000 -0.0000
-0.0000 1.0000
>> A55=A5.*a5
A55 =
1.0000 -0.0000
-0.0000 1.0000
>> A6=[cos(x(6)) -sin(x(6));sin(x(6)) cos(x(6))]
A6 =
0.0000 -1.0000
1.0000 0.0000
>> a6=A6'
a6 =
0.0000 1.0000
-1.0000 0.0000
>> A66=a6.*A6
A66 =
0.0000 -1.0000
-1.0000 0.0000
>> A66=A6.*a6
A66 =
0.0000 -1.0000
-1.0000 0.0000
>> A7=[cos(x(7)) -sin(x(7));sin(x(7)) cos(x(7))]
A7 =
-1.0000 -0.0000
0.0000 -1.0000
>> a7=A7'
a7 =
-1.0000 0.0000
-0.0000 -1.0000
>> A77=a7.*A7
A77 =
1.0000 -0.0000
-0.0000 1.0000
>> A77=A7.*a7
A77 =

1.0000 -0.0000
-0.0000 1.0000
>> A8=[cos(x(8)) -sin(x(8));sin(x(8)) cos(x(8))]
A8 =
-0.0000 1.0000
-1.0000 -0.0000
>> a8=A8'
a8 =
>> %Diketahui
:
-0.0000 -1.0000
%-5<x<2
1.0000 -0.0000

%f(x)=x^3+4x^2-x-4
%point
: 3,4,5,6,7,101
>> A88=a8.*A8
>>A88
%point
3:
=
>> x1=linspace(-5,2,3)
0.0000 -1.0000
x1 =-1.0000 0.0000
-5.0000 -1.5000 2.0000
A88=A8.*a8
>>>>y1=x1.^3+4*x1.^2-x1-4
y1A88
= =
0.0000 -1.0000
-24.0000
3.1250 18.0000
-1.0000
>> %point 40.0000
:
>> x2=linspace(-5,2,4)
>> A9=[cos(x(9)) -sin(x(9));sin(x(9)) cos(x(9))]
x2 =
A9 =
-5.0000 -2.6667 -0.3333 2.0000
1.0000 0.0000
>> y2=x2.^3+4*x2.^2-x2-4
-0.0000 1.0000
y2 =
-24.0000
>> a9=A9' 8.1481 -3.2593 18.0000
>>a9%point
5:
=
>> x3=linspace(-5,2,5)
1.0000 -0.0000
x3 =0.0000 1.0000
-5.0000 -3.2500 -1.5000 0.2500 2.0000
A99=a9.*A9
>>>>y3=x3.^3+4*x3.^2-x3-4
y3A99
= =
1.0000 -0.0000
-24.0000
7.1719 3.1250 -3.9844 18.0000
-0.0000 61.0000
>> %point
:
>> x4=linspace(-5,2,6)
x4>>
= A99=A9.*a9
A99 =
Columns 1 through 5
1.0000 -0.0000
-5.0000 -3.6000 -2.2000 -0.8000 0.6000
-0.0000 1.0000
2.0000
9. Column
(R.5.18) 6
Let us
now consider a polynomial.*Use MATLAB and obtain the plots of y = f(x) =
>>3 y4=x4.^3+4*x4.^2-x4-4
2
x + 4x x 4 over the domain 5 x 2, using 3, 4. 5, 6, 7, and 101 points (or 100
y4 =
segmented approximations).
-24.0000 4.7840 6.9120 -1.1520 -2.9440
Column
Syntax :6 18.0000
>> %point 7 :
>> x5=linspace(-5,2,7)
x5 =

Columns 1 through 5
-24.0000 4.7840 6.9120
Column 6
18.0000
>> %point 7 :
>> x5=linspace(-5,2,7)
x5 =
Columns 1 through 5
-5.0000 -3.8333 -2.6667
Columns 6 through 7
0.8333 2.0000
>> y5=x5.^3+4*x5.^2-x5-4
y5 =
Columns 1 through 5
-24.0000 2.2824 8.1481
Columns 6 through 7
-1.4769 18.0000
>> %point 101 :
>> x6=linspace(-5,2,101)
x6 =
Columns 1 through 5
-5.0000 -4.9300 -4.8600
Columns 6 through 10
-4.6500 -4.5800 -4.5100
Columns 11 through 15
-4.3000 -4.2300 -4.1600
Columns 16 through 20
-3.9500 -3.8800 -3.8100
Columns 21 through 25
-3.6000 -3.5300 -3.4600
Columns 26 through 30
-3.2500 -3.1800 -3.1100
Columns 31 through 35
-2.9000 -2.8300 -2.7600
Columns 36 through 40
-2.5500 -2.4800 -2.4100
Columns 41 through 45
-2.2000 -2.1300 -2.0600
Columns 46 through 50
-1.8500 -1.7800 -1.7100
Columns 51 through 55
-1.5000 -1.4300 -1.3600
Columns 56 through 60

-1.1520 -2.9440

-1.5000 -0.3333

3.1250 -3.2593

-4.7900 -4.7200
-4.4400 -4.3700
-4.0900 -4.0200
-3.7400 -3.6700
-3.3900 -3.3200
-3.0400 -2.9700
-2.6900 -2.6200
-2.3400 -2.2700
-1.9900 -1.9200
-1.6400 -1.5700
-1.2900 -1.2200

Columns 56 through 60
-1.1500 -1.0800 -1.0100 -0.9400 -0.8700
Columns 61 through 65
-0.8000 -0.7300 -0.6600 -0.5900 -0.5200
Columns 66 through 70
-0.4500 -0.3800 -0.3100 -0.2400 -0.1700
Columns 71 through 75
-0.1000 -0.0300 0.0400 0.1100 0.1800
Columns 76 through 80
0.2500 0.3200 0.3900 0.4600 0.5300
Columns 81 through 85
0.6000 0.6700 0.7400 0.8100 0.8800
Columns 86 through 90
0.9500 1.0200 1.0900 1.1600 1.2300
Columns 91 through 95
1.3000 1.3700 1.4400 1.5100 1.5800
Columns 96 through 100
1.6500 1.7200 1.7900 1.8600 1.9300
Column 101
2.0000
>> y6=x6.^3+4*x6.^2-x6-4
y6 =
Columns 1 through 5
-24.0000 -21.6736 -19.4529 -17.3358 -15.3204
Columns 6 through 10
-13.4046 -11.5863 -9.8635 -8.2340 -6.6959
Columns 11 through 15
-5.2470 -3.8854 -2.6089 -1.4155 -0.3032
Columns 16 through 20
0.7301 1.6865 2.5681 3.3768 4.1147
Columns 21 through 25
4.7840 5.3866 5.9247 6.4002 6.8152
Columns 26 through 30
7.1719 7.4722 7.7182 7.9119 8.0555
Columns 31 through 35
8.1510 8.2004 8.2058 8.1693 8.0929
Columns 36 through 40
7.9786 7.8286 7.6449 7.4295 7.1845
Columns 41 through 45
6.9120 6.6140 6.2926 5.9498 5.5877
Columns 46 through 50

Columns 51 through 55
3.1250 2.6854 2.2429
Columns 56 through 60
0.9191 0.4859 0.0601
Columns 61 through 65
-1.1520 -1.5274 -1.8851
Columns 66 through 70
-2.8311 -3.0973 -3.3354
Columns 71 through 75
-3.8610 -3.9664 -4.0335
Columns 76 through 80
-3.9844 -3.8776 -3.7223
Columns 81 through 85
-2.9440 -2.5736 -2.1444
Columns 86 through 90
-0.4826 0.2028 0.9574
Columns 91 through 95
3.6570 4.7090 5.8404
Columns 96 through 100
9.7321 11.2020 12.7617
Column 101
18.0000

1.7997

1.3578

-0.3562 -0.7609
-2.2230 -2.5390
-3.5434 -3.7193
-4.0603 -4.0446
-3.5163 -3.2575
-1.6542 -1.1009
1.7833

2.6825

7.0534

8.3499

14.4133 16.1587

>> plot(x1,y1,'b:h',x2,y2,'m-d',x3,y3,'c-.^',x4,y4,'g--p',x5,y5,'y-s',x6,y6,'r-*')
>>

Hasil Run Program dan Grafik Keseluruhan Point 3,4,5,6,7 dan 101

10. (R.5.19) Let us now plot the trigonomertric function f(x) = y =1.5 cos(2x), over the domain 0
x 2 , using 5, 10, 15, and 20 points, and the corresponding segmented
approximations.
Syntax :
>> x1 = linspace (0,2,5)
x1 =
0 0.5000 1.0000
>> a = x1*pi
a=
0 1.5708 3.1416
>> x2 = linspace (0,2,10)
x2 =
0 0.2222 0.4444
>> b = x2*pi
b=
0 0.6981 1.3963
>> x3 = linspace(0,2,15)
x3 =

1.5000

2.0000

4.7124

6.2832

0.6667

0.8889

1.1111 1.3333

1.5556

1.7778

2.0000

2.0944

2.7925

3.4907

4.8869

5.5851

6.2832

4.1888

Columns 1 through 10
0 0.1429 0.2857 0.4286 0.5714 0.7143 0.8571 1.0000 1.1429 1.2857
Columns 11 through 15
1.4286 1.5714 1.7143 1.8571 2.0000
>> c = x3*pi
c=
Columns 1 through 10
0 0.4488 0.8976 1.3464 1.7952 2.2440 2.6928 3.1416 3.5904 4.0392
Columns 11 through 15
4.4880 4.9368 5.3856 5.8344 6.2832
>> x4 = linspace(0,2,20)
x4 =
Columns 1 through 10
0 0.1053 0.2105 0.3158 0.4211 0.5263 0.6316 0.7368 0.8421 0.9474
Columns 11 through 20
1.0526 1.1579 1.2632 1.3684 1.4737 1.5789 1.6842 1.7895 1.8947
2.0000
>> d = x4*pi
d=
Columns 1 through 10
0 0.3307 0.6614 0.9921 1.3228 1.6535 1.9842 2.3149 2.6456 2.9762
Columns 11 through 20
3.3069 3.6376 3.9683 4.2990 4.6297 4.9604 5.2911 5.6218 5.9525
6.2832
>> y1 = 1.5*cos(2*a)
y1 =
1.5000 -1.5000 1.5000 -1.5000 1.5000
>> y2 = 1.5*cos(2*b)
y2 =
1.5000 0.2605 -1.4095 -0.7500 1.1491 1.1491 -0.7500 -1.4095 0.2605
1.5000
>> y3 = 1.5*cos(2*c)
y3 =
Columns 1 through 10
1.5000 0.9352 -0.3338 -1.3515 -1.3515 -0.3338 0.9352 1.5000 0.9352
-0.3338
Columns 11 through 15
-1.3515 -1.3515 -0.3338 0.9352 1.5000
>> y4 = 1.5*cos(2*d)
y4 =
Columns 1 through 10

1.5000 1.1837 0.3682 -0.6025 -1.3192 -1.4795 -1.0159 -0.1239 0.8204


1.4187
Columns 11 through 20
1.4187 0.8204 -0.1239 -1.0159 -1.4795 -1.3192 -0.6025 0.3682 1.1837
1.5000
>> plot (a,y1,'g-s',b,y2,'k->',c,y3,'r-p',d,y4,'b-h')
>> grid on

>> x = [-2:0.4:2]*pi
x=
Columns 1 through 10
-6.2832 -5.0265 -3.7699 -2.5133 -1.2566

1.2566

2.5133

3.7699

5.0265
Column 11
6.2832
>> y1 = sin(x)
y1 = The following example illustrates the use of the commandse:legend, box, grid,
11. (R.5.73)
xkabel,
ylabel,1 text,
and10
lttlefor the following plots :
Columns
through
Y1(x) = sin(x) and y2(x)= sin2(x)/x
0.0000 0.9511 0.5878 -0.5878 -0.9511
0 0.9511 0.5878 -0.5878
Over the domain 2 x 2 in linier increments (spacing) of 0,4. The dotted line
-0.9511

11 are used to plot y (x) versus x, and the dashed line and square
andColumn
star markers
1

-0.0000
markers
for the plot y2(x) versus x.
Syntax
>> y2 =: sin(x).^2/x
y2 = 0
>> plot(x,y1,'b-.*',x,y2,'k-s')
>>xlabel ('variabel x bebas')
>>ylabel('variabel y bebas')
>>title('Grafik problem 5.73')
>> legend('y1','y2')
text(0.7,0.5,'y1')
text(-6,0,'y2')
>> grid on

Hasil Run Program dan Grafik dari Problem R.5.73

12. (R.5.46) For example let y1 = 10 sin(x) and y2(x) = 2 cos(x) + noise(x), where noise(x) is a
random function over the range 0 x 3 using 100 linearly spaced points. Create a
program that return the following plots:
a. [y1 = 10 sin(x)] versus x and [y2 = 2 cos(x) + noise(x)] versus x using the same y scale
b. [y1 = 10 sin(x)] versus x and [y2 = 2 cos(x)+ noise(x)] versus x using different y scales

Columns 49 through 60
1.4545
Syntax :1.4848 1.5152 1.5455 1.5758 1.6061 1.6364 1.6667
1.6970 1.7273 1.7576 1.7879
Columns 61 through 72
>>1.8182
noise=rand(1,100)
1.8485 1.8788 1.9091 1.9394 1.9697 2.0000 2.0303
noise = 2.0909 2.1212 2.1515
2.0606
Columns 73
1 through
through13
84
0.8147 2.2121
0.9058 2.2424
0.1270 2.2727
0.9134 2.3030
0.6324 2.3333
0.0975 2.3636
0.2785 2.3939
0.5469
2.1818
0.9575 2.4545
0.9649 2.4848
0.1576 2.5152
0.9706 0.9572
2.4242
14 through 96
26
Columns 85
0.4854 2.5758
0.8003 2.6061
0.1419 2.6364
0.4218 2.6667
0.9157 2.6970
0.7922 2.7273
0.9595 2.7576
0.6557
2.5455
0.0357
0.8491
0.9340
0.6787
0.7577
2.7879 2.8182 2.8485 2.8788
27 through 100
39
Columns 97
0.7431 2.9394
0.3922 2.9697
0.6555 3.0000
0.1712 0.7060 0.0318 0.2769 0.0462
2.9091
0.0971
0.8235 0.6948 0.3171 0.9502
>>
x1=x*pi
Columns
40 through 52
x1
=
0.0344
0.3816 0.7655 0.7952 0.1869 0.4898 0.4456
Columns 1 0.4387
through 12
0.6463
0.7094 0.1904
0.7547 0.2856
0.2760 0.3808
0.6797 0.4760 0.5712 0.6664
0 0.0952
Columns0.8568
53 through
65
0.7616
0.9520
1.072
0.6551 130.1626
0.4984 0.9597 0.3404 0.5853 0.2238
Columns
through 0.1190
24
0.7513
1.1424 0.2551
1.2376 0.5060
1.3328 0.6991
1.4280 0.8909
1.5232 1.6184 1.7136 1.8088
Columns
66
through
78
1.9040 1.9992 2.0944 2.1896
0.9593 250.5472
0.1493 0.2575 0.8407 0.2543 0.8143
Columns
through 0.1386
36
0.2435
2.2848 0.9293
2.3800 0.3500
2.4752 0.1966
2.5704 0.2511
2.6656 2.7608 2.8560 2.9512
Columns3.1416
79 through
91
3.0464
3.2368
3.3320
0.6160 370.4733
0.8308 0.5853 0.5497 0.9172 0.2858
Columns
through 0.3517
48
0.7572
0.7537
0.3804
0.5678
3.4272 3.5224 3.6176 3.7128 0.0759
3.8080 3.9032 3.9984 4.0936
Columns4.2840
92 through
100 4.4744
4.1888
4.3792
0.0540 490.5308
0.9340 0.1299 0.5688 0.4694 0.0119
Columns
through 0.7792
60
0.3371
4.5696 4.6648 4.7600 4.8552 4.9504 5.0456 5.1408 5.2360
>> x=linspace(0,3,100)
5.3312
5.4264 5.5216 5.6168
xColumns
=
61 through 72
Columns
through 12
5.7120 1 5.8072
5.9024 5.9976 6.0928 6.1880 6.2832 6.3784
0 6.5688
0.0303 6.6640
0.0606 6.7592
0.0909 0.1212 0.1515 0.1818 0.2121
6.4736
0.2424
0.3030
0.3333
Columns0.2727
73 through
84
Columns
through7.0448
24
6.8544 13
6.9496
7.1400 7.2352 7.3304 7.4256 7.5208
0.3636
0.3939
0.4242
0.4545 0.4848 0.5152 0.5455 0.5758
7.6160 7.7112 7.8064 7.9016
0.6061
0.6667
0.6970
Columns0.6364
85 through
96
Columns
through8.1872
36
7.9968 25
8.0920
8.2824 8.3776 8.4728 8.5680 8.6632
0.72738.8536
0.75768.9488
0.78799.0440
0.8182 0.8485 0.8788 0.9091 0.9394
8.7584
0.9697
1.0303
1.0606
Columns 1.0000
97 through
100
Columns
through9.3296
48
9.1392 37
9.2344
9.4248
1.1212 1.1515 1.1818 1.2121 1.2424 1.2727 1.3030
>>1.0909
y1=10*sin(x1)
1.3333
1.3636 1.3939 1.4242
y1
=
Columns 1 through 12
0 0.9506 1.8925 2.8173 3.7166 4.5823 5.4064 6.1816
6.9008 7.5575 8.1458 8.6603

Columns 13 through 24
9.0963 9.4500 9.7181 9.8982
9.4500 9.0963 8.6603 8.1458
Columns 25 through 36
7.5575 6.9008 6.1816 5.4064
0.9506 0.0000 -0.9506 -1.8925
Columns 37 through 48
-2.8173 -3.7166 -4.5823 -5.4064
-8.6603 -9.0963 -9.4500 -9.7181
Columns 49 through 60
-9.8982 -9.9887 -9.9887 -9.8982
-8.1458 -7.5575 -6.9008 -6.1816
Columns 61 through 72
-5.4064 -4.5823 -3.7166 -2.8173
1.8925 2.8173 3.7166 4.5823
Columns 73 through 84
5.4064 6.1816 6.9008 7.5575
9.7181 9.8982 9.9887 9.9887
Columns 85 through 96
9.8982 9.7181 9.4500 9.0963
6.1816 5.4064 4.5823 3.7166
Columns 97 through 100
2.8173 1.8925 0.9506 0.0000
>> y2=2*cos(x1)+noise
y2 =
Columns 1 through 12
2.8147 2.8967 2.0908 2.8324
2.4050 2.2746 1.3177 1.9706
Columns 13 through 24
1.7880 1.1395 1.2718 0.4265
0.0016 -0.7951 -0.1509 -0.2261
Columns 25 through 36
-0.6310 -0.6897 -0.8290 -1.2903
-1.7140 -1.9538 -1.8938 -1.1404
Columns 37 through 48
-1.2242 -1.5396 -0.8274 -1.6481
-0.8131 -0.3411 -0.2085 0.1748
Columns 49 through 60
0.4247 0.6595 0.3712 0.9643
2.1199 1.6501 2.0327 1.7959
Columns 61 through 72
2.4338 2.0328 2.3627 2.6181
2.1132 2.1765 2.6975 2.0320
Columns 73 through 84
2.4968 1.8156 2.3767 1.6597
0.8232 1.1155 0.6804 0.4546
Columns 85 through 96

9.9887

9.9887

9.8982

9.7181

4.5823

3.7166

2.8173

1.8925

-6.1816 -6.9008 -7.5575 -8.1458


-9.7181 -9.4500 -9.0963 -8.6603
-1.8925 -0.9506 -0.0000

0.9506

8.1458

8.6603

9.0963

9.4500

8.6603

8.1458

7.5575

6.9008

2.4891

1.8752

1.9610

2.1190

0.5169

0.8206

0.5076

0.4880

-1.1222 -1.6855 -1.2129 -1.9320


-1.1334 -1.0659 -0.5442 -0.3649
1.1266

0.8167

0.9498

1.4984

2.8548

2.9502

2.5472

2.1296

1.3567

1.2511

1.4469

1.1274

0.6326 -0.1857 0.1031 -0.0771 -0.6196 -0.5923 -1.2339 -1.3935


-1.0413 -0.9033 -0.8437 -1.7268
Columns 97 through 100
-1.3502 -1.4945 -1.9790 -1.6629
>> plot(x1,y1,x1,y2)
>> grid on
>> title('Grafik Problem R.5.46, Pebri Yeni Samoisr')
>>
Hasil Run Program (Tampilan Command Window)

You might also like