Program A = [16 3 2 13; 5 10 11 8; 9 6 7 12; 4 15 14 1] B = [1 2 3 4 5; 6 7 8 9 10] sum(A) A'
Latihan 2
Gambar 2. Perintah sum, tranpose serta diag
Program A = [16 3 2 13; 5 10 11 8; 9 6 7 12; 4 15 14 1] B = [1 2 3 4 5; 6 7 8 9 10] sum(B) B' sum(A')' diag(A) sum(diag(A)) sum(diag(fliplr(A))) B = rand(1:5)% membangkitkan bilangan acak yang terdistribusi uniform/seragam C= randn(1:10)% membangkitkan bilangan acak yang terdistribusi normal/Gaussian.
Latihan 3
Gambar 3. Menetukan elemen garis dan kolom dalam matrik
Program A = [16 3 2 13; 5 10 11 8; 9 6 7 12; 4 15 14 1] A(2,:) A(3,:) A(:,4) X = A; X(4,5) = 17
Latihan 4
Gambar 4. Membuat matrik nol, matrik identitas, serta matrik
satu Program K = eye(5) L = zeros(2,5) M = ones(2,5)
Latihan 5
Gambar 5. Membuat matrik dengan operator colon
Program P = [2:2:12; 12:-2:2; 10:7:45] Q = [P;ones(1,6)]
Latihan 6
Gambar 6. Menampilkan sinyal sinus
Program t = 0:0.001:2*pi; S1 = sin(t); S2 = 2*sin(t); S3 = sin(2*t); S4 = sin(t-pi); figure(1) subplot(2,2,1); plot(t,S1,'r'); grid on title('S1 = sin(t) (waldito febri ramadhan)'); subplot(2,2,2); plot(t,S2,'b.'); grid on title('S2 = 2*sin(t) (waldito febri ramadhan)'); subplot(2,2,3); plot(t,S3,'black-.'); grid on title('S3 = sin(2*t) (waldito febri ramadhan)'); subplot(2,2,4); plot(t,S4,'green--'); grid on title('S4 = sin(t - pi) (waldito febri ramadhan)');
latihan 7
Gambar 7. Menampilkan sinyal termodulasi fm
Program function FM =sinyal_fm(Ac,m,fi,fc) % --Signal Processing Laboratory-% -- Fungsi untuk sinyal termodulasi AM % Ac = Amplitudo sinyal carrier % m = indeks modulasi % fi = frekuensi informasi % fc = frekuensi carrier t = 0:0.001:2; si = cos(2*pi*fi*t); % sinyal informasi sc = Ac*sin(2*pi*fc*t); % sinyal pembawa FM = Ac*cos(si+m*sc); subplot(3,1,1);plot(t,si); xlabel('t(detik)');ylabel('Amplitudo'); title('Sinyal Informasi (Waldito Febri Ramadhan)'); subplot(3,1,2);plot(t,sc) xlabel('t(detik)');ylabel('Amplitudo'); title('Sinyal Pembawa (Waldito Febri Ramadhan)'); subplot(3,1,3);plot(t,FM) xlabel('t(detik)');ylabel('Amplitudo'); title('Sinyal Termodulasi AM (Waldito Febri Ramadhan');