Anda di halaman 1dari 9

TUGAS INDIVIDU 4

PIRANTI LUNAK TELEKOMUNIKASI

OLEH
I KADEK AGUS WAHYU RAHARJA (1404405060)

JURUSAN TEKNIK ELEKTRO DAN KOMPUTER


FAKULTAS TEKNIK
UNIVERSITAS UDAYANA
2016
1. Soal Latihan 1

Jawaban:
a. [A,B]=fn(I1,I2,I3), I1 I2 I3 sudah ditentukan nilainya
function [A,B]=fn(I1,I2,I3);
I1 = pi;
I2 = pi/2;
I3 = pi/3;
%fungsi dibawah dibuat sendiri
A = [I1,I2,I3];%membuat matriks 1xinput
B = A';%tranpose matriks A

Command Window :
>> [A,B]=fn
A =
3.1416 1.5708 1.0472

B =
3.1416
1.5708
1.0472

b. [A,B]=fn(0,5,pi),
function [A,B]=fn(I1,I2,I3);
%fungsi dibawah dibuat sendiri
A = [I1,I2,I3];%membuat matriks 1xinput
B = A';%tranpose matriks A

Command Window :
>> [A,B]=fn(0,5,pi)
A =
0 5.0000 3.1416

B =

0
5.0000
3.1416
c. fn(2,-2.5,3.89),
function [A,B]=fn(I1,I2,I3);
%fungsi dibawah dibuat sendiri
A = [I1,I2,I3];%membuat matriks 1xinput
B = A';%tranpose matriks A

Command Window :

fn(2,-2.5,3.89)

ans =

2.0000 -2.5000 3.8900


2. Soal Latihan 2

Jawaban:
Berikut adalah program fungsi untuk menampilkan nilai dari output t dan y
dengan range data dari 0, 1, 2, 3, 4, 5 pada nilai t.
function [t,y]=sine_fn(A,w,ph);
x=0;
while x<=5;
t = 0+x
y = A*sin(w.*t+ph)
x=x+1;
end

Berikut adalah program fungsi untuk menampilkan plot nilai dari output t
dan y dengan range data dari 0 sampai 5 pada nilai t, dimana pada range
tersebut diberikan 15 buah node.
function [t,y] = sine_fn2(A, w, ph)
%Berikut program dalam mem plot nilai dari t dan y ke dalam
bentuk grafik
t = linspace(0, 5, 15);
y = A*sin(w.*t + ph) ;
plot(t,y);
xlabel('t');
ylabel('y(t)');
3. Soal Latihan 3

Jawaban:
Berikut adalah hasil dari fungsi sine_fn untuk nilai input soal a, b, c
Command Window :

>> %no a
>> [t,y]=sine_fn(3,pi,pi/4)

t =
0
y =
2.1213
t =
1
y =
-2.1213
t =
2
y =
2.1213
t =
3
y =
-2.1213
t =
4
y =
2.1213
t =
5
y =
-2.1213
t =
5
y =
-2.1213
>> %no b
>> sine_fn(3,pi,pi/4)

t =
0
y =
2.1213
t =
1
y =
-2.1213
t =
2
y =
2.1213
t =
3
y =
-2.1213
t =
4
y =
2.1213
t =
5
y =
-2.1213
ans =
5

>> %no c
>> A = 3.5*sqrt(2);w = pi-2/3;ph = pi/7;
>> [t,y]=sine_fn(A,w,ph)

t =
0
y =
2.1476
t =
1
y =
1.0699
t =
2
y =
-3.8292

t =
3
y =
4.9488
t =
4
y =
-3.9492
t =
5
y =
1.2584
t =
5
y =
1.2584

Berikut adalah hasil dari fungsi sine_fn2 untuk nilai input soal a, b, c
Command Window : Gambar :
>> %no a No a :
>> [t,y] = sine_fn2(3,pi,pi/4)

t=
Columns 1 through 3
0 0.3571 0.7143
Columns 4 through 6
1.0714 1.4286 1.7857
Columns 7 through 9
2.1429 2.5000 2.8571
Columns 10 through 12
3.2143 3.5714 3.9286
Columns 13 through 15
4.2857 4.6429 5.0000
y=
Columns 1 through 3
2.1213 2.8316 0.3359
Columns 4 through 6
-2.5402 -2.5402 0.3359
Columns 7 through 9
2.8316 2.1213 -0.9908
Columns 10 through 12
-2.9811 -1.5961 1.5961
Columns 13 through 15
2.9811 0.9908 -2.1213

Command Window : Gambar :


>> %no b No b :
>> sine_fn2(3,pi,pi/4)
ans =
Columns 1 through 3
0 0.3571
0.7143
Columns 4 through 6
1.0714 1.4286
1.7857
Columns 7 through 9
2.1429 2.5000
2.8571
Columns 10 through 12
3.2143 3.5714
3.9286
Columns 13 through 15
4.2857 4.6429
5.0000
Command Window : Gambar :
>> %no c No c :
>> A = 3.5*sqrt(2);w =
pi-2/3;ph = pi/7;
>>
[t,y]=sine_fn2(A,w,ph)
t =
Columns 1 through 3
0 0.3571
0.7143
Columns 4 through 6
1.0714 1.4286
1.7857
Columns 7 through 9
2.1429 2.5000
2.8571
Columns 10 through 12
3.2143 3.5714
3.9286
Columns 13 through 15
4.2857 4.6429
5.0000
y =
Columns 1 through 3
2.1476 4.8101
3.9529
Columns 4 through 6
0.2033 -3.6951
-4.8897
Columns 7 through 9
-2.5064 1.7109
4.6763
Columns 10 through 12
4.2199 0.6758
-3.3629
Columns 13 through 15
-4.9408 -2.9035
1.2584

Anda mungkin juga menyukai