Matlab mixed IIR Filter
2 views (last 30 days)
I need help to design the next IIR filter:
The input signal is composed of 1Hz and 30Hz sine waves. The signal sampling frequency is 100Hz and a total of 480 points are sampled. Signals below 7Hz are removed by the IIR.
There are 480 samples. Sample 0~159 are 30Hz sine waves, sample 160~319 are 1Hz sine waves and sample 320~479 are 30Hz sine waves.
I tried to do, but it looks not correct.
fs=100 % sampling frequency
f2=30 % frequency of the signal
t=20 % time duration
n=[0:1/fs:t] % sample period
x1=sin(2*pi*f1*n) % single tone signal
% lssnew = merge(lss1,...,lssN)
z = [x1;x2]; % merge 2 signals
Could someone give me an example how I can do it?
Thank you in advance.
Mathieu NOE on 6 Dec 2022
this can be genralizd for a arbritary sequence of x1 / x2 signals
NB that a sampling frequency of 100 Hz is a bit low to reproduce a 30 Hz tone with a good accuracy ; would rather suggest to increase to 300 Hz at least
fs=100; % sampling frequency
f2=30; % frequency of the signal
% t=20 % time duration
samples = 160 ; % for each block of data for 1 frequency
dt = 1/fs;
t = (0:samples-1)*dt; % sample period
x1=sin(2*pi*f1*t); % single tone signal
z = [x1 x2 x1]; % merge 3 signals
tz = (0:3*samples-1)*dt; % time for 3 signals