Oleh :
I Nyoman Krisna Adi Saputra
1106050866
Script Matlab
clc
clear
close
%======================Superposisi Dua Gelombang=========================%
recl=1; %record lenght
int = 0.001; %interval
tt = 0:int:recl; % t_awal = 0; t_akhir = record lenght; interval =
A=1;
fss1 = 30; % frekuensi gelombang 1
theta1 = 0; % sudut fase gelombang 1
II.
Hasil Superposisi
B. Sampling
I.
Script Matlab
%=============================Sampling===================================%
Ts = 0.002; % periode sampling
t = 0:Ts:recl; % waktu sampling
yy1 = A*sin(2*pi*fss1*t + theta1); % persamaan gelombang 1
yy2 = A*sin(2*pi*fss2*t + theta2); % persamaan gelombang 2
x = yy1 + yy2; % superposisi gelombang
subplot(4,1,1)
plot(tt,y3) % menggambar grafik superposisi gelombang
xlabel('Waktu, t (detik)');
ylabel('Amplitudo');
title('\fontsize{14} Superposisi gelombang 30 Hz dan 50 Hz');
subplot(4,1,2)
stem(t,x,'or','LineWidth',2), grid on % plot nomor sampling vs waktu
xlabel('Data sampling dalam waktu, (detik)');
ylabel('Amplitudo');
subplot(4,1,3)
stem(x,'or','LineWidth',2), grid on % plot nomor sampling
axis([1 length(t) -A A])
xlabel('Nomor sampling');
ylabel('Amplitudo');
subplot(4,1,4)
plot(t,x,'LineWidth',2), grid on % plot gelombang & panjang rekaman
xlabel('Waktu, t (detik)');
ylabel('Amplitudo');
title('\fontsize{14} Hasil rekonstruksi dengan sampling 2ms');
II.
Hasil Sampling
Script Matlab
%==========================Perbandingan Sampling=========================%
Ts1 = 0.002; % periode sampling
t1 = 0:Ts1:recl; % waktu sampling
yy11 = A*sin(2*pi*fss1*t1 + theta1); % persamaan gelombang 1 sampling 2ms
yy21 = A*sin(2*pi*fss2*t1 + theta2); % persamaan gelombang 2 sampling 2ms
x1 = yy11 + yy21; % superposisi gelombang sampling 2ms
Ts2 = 0.004; % periode sampling
t2 = 0:Ts2:recl; % waktu sampling
yy12 = A*sin(2*pi*fss1*t2 + theta1); % persamaan gelombang 1 sampling 4ms
yy22 = A*sin(2*pi*fss2*t2 + theta2); % persamaan gelombang 2 sampling 4ms
x2 = yy12 + yy22; % superposisi gelombang sampling 4ms
subplot(3,1,1)
plot(tt,y3) % menggambar grafik superposisi gelombang
xlabel('Waktu, t (detik)');
ylabel('Amplitudo');
title('\fontsize{14} Superposisi gelombang 30 Hz dan 50 Hz');
subplot(3,1,2)
plot(t1,x1,'LineWidth',2), grid on % plot rekonstruksi sampling 2ms
xlabel('Waktu, t(detik)');
ylabel('Amplitudo');
title('\fontsize{14} Hasil rekonstruksi dengan sampling 2ms');
subplot(3,1,3)
plot(t2,x2,'LineWidth',2), grid on % plot rekonstruksi sampling 4ms
xlabel('Waktu, t(detik)');
ylabel('Amplitudo');
title('\fontsize{14} Hasil rekonstruksi dengan sampling 4ms');
II.
Hasil Perbandingan