Sunteți pe pagina 1din 1

Script Matlab soal nomor 1 (a figure 1 dan b figure 2)

clc
clear all
close all
%syarat awal 0 <= n =< 10
n = 1;
t = (1:10)/n;
x = (10*(0.17)*n)*t;
y = x*((-n))*11;
z = real (x);
%Create fungsi Real
z2 = imag (x);
%Create fungsi Imaginer
figure (1)
plot (t,y);
xlabel('Waktu (Sec)','FontSize',11); %Create Xlabel
ylabel('Magnitude','FontSize',11);
%Create Ylabel
figure (2)
subplot (2,1,1)
plot(t,z, 'r' )
xlabel('Waktu (Sec)','FontSize',11); %Create Xlabel
ylabel('Magnitude','FontSize',11);
%Create Ylabel
title({'GRAFIK FUNGSI REAL'},'FontSize',14); %Create Title
subplot (2,1,2)
plot(t,z2)
xlabel 'Waktu (Sec)', 'Fontsize'; 14; %Create Xlabel
ylabel 'Magnitude', 'Fontsize'; 14;
%Create Ylabel
title({'GRAFIK FUNGSI IMAGINER'},'FontSize',14); %Create Title

Script Matlab soal nomor 2 (a figure 1 dan b figure 2)


n = 5;
t = (1:10)/n;
% Time vector
t2 = (1:100)/n;
% Time vector
x = (cos(14*pi*n*t))+ (cos(0.7*pi*n*t));
x2 = (cos(14*pi*n*t2))+ (cos(0.7*pi*n*t2));
y = fft(x);
% Compute DFT of x
y2 = fft(x2);
% Compute DFT of x2
m = abs(y);
% Magnitude
m2 = abs(y2);
% Magnitude
figure (1)
stem(t,m);
xlabel('Waktu (Sec)','FontSize',11);
%Create Xlabel
ylabel('Magnitude','FontSize',11);
%Create Ylabel
title({'DISCRETE FOURIER TRANSFORM'},'FontSize',14); %Create Title
figure (2)
stem (t2,m2);
xlabel('Waktu (Sec)','FontSize',11);
%Create Xlabel
ylabel('Magnitude','FontSize',11);
%Create Ylabel
title({'DISCRETE FOURIER TRANSFORM'},'FontSize',14); %Create Title