Anda di halaman 1dari 2

# Pembangkitan sinyal waktu kontinyu sinusoida

Fs = 100
t = (1:100)/Fs
s1=sin(2*pi*t*5)
plot(t,s1)
hold on
s1=5*sin(2*pi*t*5)
plot(t,s1)
hold on
s1=2*sin(2*pi*t*5 + pi/2)
plot(t,s1)
hold on
legend('kurva1 frek 5', 'kurva2 frek 5', 'kurva3 frek 5')
title('Sinusoida Kontinyu')
xlabel('Waktu (s)')
ylabel('Amplitudo')
hold on

# Pembangkitan sinyal Waktu Kontinyu Persegi

Fs=100
t=(1:100)/Fs
s1=square(2*pi*5*t)
plot(t,s1,'linewidth',2)
hold on
s1=square(2*pi*5*t + pi/2)
plot(t,s1,'linewidth',2)
hold on
axis([0 1 -1.2 1.2])
legend('kurva square1 frek 5', 'kurva square2 frek 5')
title('Persegi Kontinyu')
xlabel('Waktu (s)')
ylabel('Amplitudo')
hold on

# Pembangkitan sinyal dengan memanfaatkan file *.wav

y1=audioread('file_example_WAV_1MG.wav');
Fs=20000;
player = audioplayer (y1, Fs);
play (player);
plot(y1)

# Pembangkitan sinyal kontinyu, fungsi ramp

y(1:40)=1
x(1:50)=[1:0.1:5.9]
x(51:100)=5.9
t1=[-39:1:0]
t=[0:1:99]
plot(t1,y,'b',t,x,'linewidt',4)
title('Fungsi Ramp')
xlabel('Waktu (s)')
ylabel('Amplitudo')

# Pembangkitan fungsi unit step


t=-20:0.001:20
y=heaviside(t)
plot(t,y,'Linewidth',3)
axis([-20 20 -2 2])
title('Fungsi unit step')
xlabel('Waktu (s)')
ylabel('f(x)')

Anda mungkin juga menyukai