Question : Design the low and high pass filter for the signal, x(t) = 10 sin (10 t) + 1 sin (1000 t) by MATLAB
Is below answer right?
at ?High pass , 5row
shouldn't this change from sin(100*t) ?
sin(1000*t)
x = 10*sin(10*t) + 1*sin(100*t); ? x = 10*sin(10*t) +
1*sin(1000*t); ???
.....................................................................................................................................................
?Low pass
clc;
rng default
Fs=2000;
t=linspace(0,1,Fs);
x=10*sin(10*t)+sin(1000*t)%given signal
n=0.5*randn(size(t));%noise
x1=x+n;
fc=150;
Wn=(2/Fs)*fc;
b=fir1(20,Wn,'low',kaiser(21,3));
%fvtool(b,1,’Fs’,Fs)
y=filter(b,1,x1);
plot(t,x1,t,y)
xlim([0 0.1])
xlabel('Time (s) ')
ylabel('Amplitude')
legend('Original Signal','Filtered Data')
.................................................................................................................................................................
?High pass
clc;close all;clear all;
fs = 1000; % sampling frequency is 1000Hz
ts = 1/fs; % Sample time
t = 0:ts:1;
x = 10*sin(10*t) + 1*sin(100*t);
% Lets filter this ginal for high frequency compenent at 100rad
/sec
% i have chosen a sampling frequency of 1000 samples/sec and
cutoff
% frequency of 100 rad/sec This will allow 1000 rad/sec and
% eliminate 10 rad/sec
fc = 100/(2*pi); % Cutoff frequency of Highpass Filter
order = 5;
[b,a] = butter(order,fc/(fs/2),'high'); % Butter worth filter of
order 5
y = filter(b,a,x) ; % Filter the signal
figure;plot(t,x,t,y);grid;title('Input and filtered
signals');
% Plot the input and filtered signals
legend('x(t)','Filtered signal');
xlabel('Time');ylabel('Amplitude');
clc;close all;clear all;
fs = 1000; % sampling frequency is 1000Hz
ts = 1/fs; % Sample time
t = 0:ts:1;
x = 10*sin(10*t) + 1*sin(1000*t);
% Lets filter this ginal for high frequency compenent at 100rad
/sec
% i have chosen a sampling frequency of 1000 samples/sec and
cutoff
% frequency of 100 rad/sec This will allow 1000 rad/sec and
% eliminate 10 rad/sec
fc = 100/(2*pi); % Cutoff frequency of Highpass Filter
order = 5;
[b,a] = butter(order,fc/(fs/2),'high'); % Butter worth filter of order 5
y = filter(b,a,x) ; % Filter the signal
figure;plot(t,x,t,y);grid;title('Input and filtered
signals');
% Plot the input and filtered signals
legend('x(t)','Filtered signal');
xlabel('Time');ylabel('Amplitude');
Get Answers For Free
Most questions answered within 1 hours.