x(t) masuk ke H(s)
Program Matlab untuk di mana sebuah fungsi x(t) dilewatkan ke sebuah sistem H(s)
Program 1:
close all;
clear all;
t=0:0.0001:1;
x1=10*sin(2*pi*10*t);
x2=10*sin(2*pi*500*t);
subplot(2,1,1);
plot(t,x1);
hold on
%plot(t,x2);
% H(s) = (0.5s +1)/(1E-4s2 + 0.01s +1)
NUM = [0 0 1];
DEN = [1e-8 1e-4 1];
sysku = tf(NUM,DEN);
y2=lsim(sysku,x2,t);
y1=lsim(sysku,x1,t);
subplot(2,1,2);
plot(t,y1);
hold on
plot(t,y2) ;
text(0.015, 2.5, ‘y1(t)’);
text(0.01, 0.35, ‘y2(t)’);
title(‘Filtering action of a low pass filter’);
ylabel(‘y1 and y2’);
xlabel(‘time (s)’);
subplot(2,1,1);
ylabel(‘x1 and x2′) ;
figure;
w = [0.1: 0.1: 10000];
bode(sysku,w);
%setoptions(h,’FreqUnits’,’Hz’,’PhaseVisible’,’off’)
grid on
h = gcr; % Get the handle for the “plot object root”
% which is a structure containing the plot properties
% Set frequency axis to Hz
h.AxesGrid.Xunits = ‘Hz’;
% Set mag axis to abs & phase axis to deg
%h.AxesGrid.Yunits = {‘abs’,’deg’};
% Turn on the grid
grid on; % or h.AxesGrid.Grid = “on”
Program2:
close all;
clear all;
t=0:0.0001:1;
x1=10*sin(2*pi*10*t);
x2=10*sin(2*pi*500*t);
subplot(2,1,1);
plot(t,x1);
hold on
%plot(t,x2);
% H(s)=72x(s+2)/s(s+50)(s+250)(s+1000)(s2 + 2.4s + 144)
NUM = [72 144];
root_DEN1 = [0 -50 -250 -1000];
DEN1 = poly(root_DEN1);
DEN2 = [1 2.4 144];
DEN = conv(DEN1,DEN2);
sysku = tf(NUM,DEN);
y2=lsim(sysku,x2,t);
y1=lsim(sysku,x1,t);
subplot(2,1,2);
plot(t,y1);
hold on
plot(t,y2) ;
text(0.015, 2.5, ‘y1(t)’);
text(0.01, 0.35, ‘y2(t)’);
title(‘Filtering action of a low pass filter’);
ylabel(‘y1 and y2’);
xlabel(‘time (s)’);
subplot(2,1,1);
ylabel(‘x1 and x2′) ;
figure;
w = [0.1: 0.1: 10000];
bode(sysku,w);
%setoptions(h,’FreqUnits’,’Hz’,’PhaseVisible’,’off’)
grid on
h = gcr; % Get the handle for the “plot object root”
% which is a structure containing the plot properties
% Set frequency axis to Hz
h.AxesGrid.Xunits = ‘Hz’;
% Set mag axis to abs & phase axis to deg
%h.AxesGrid.Yunits = {‘abs’,’deg’};
% Turn on the grid
grid on; % or h.AxesGrid.Grid = “on”