The cause of the incident is shown in the figure below 1, My friend talks about the first-order low-pass filter , The principle of the first-order low-pass filter is introduced in detail , And attached matlab Simulation code . chart 1 The formula of the first-order low-pass digital filter in is Eq(1):
y(n) = q*x(n) + (1-q)*y(n-1) Eq(1)
among ,y(n) Represents the current output ,x(n) Represents the current input ,y(n-1) Represents the last output ( chart 1 Nonstandard symbols , Because the time domain is usually in lowercase , Frequency domain or Z Field is capitalized ).Eq(1) It is a difference equation , Difference equations are often used in the analysis of discrete systems , The difference equation is usually solved in z Domain implementation ,z Transformation makes problem analysis simple . This is a IIR wave filter , What is that FIR wave filter ? What is? IIR What about the filter ?FIR The filter is finite input and limited output , In other words, when the input is 0 The output is also 0, The system has no feedback ; and IIR When the input of the filter is 0 There can also be output , Due to the addition of feedback loop , The system has the possibility of unstable divergence , therefore IIR Is better than FIR A little more complicated .
chart 1
We will formulate the formula Eq(1) conduct z By transformation z Domain transfer function . see Eq(2), Pay attention to it z Uppercase of field , We need to meet the norms . according to Eq(2), The system has one pole z=1-q And a zero z=0, What we care about here is the pole . When the pole is at z Time in unit circle , The system is stable , Otherwise, the system is unstable and will diverge . Unit circle is an important concept ,z The unit circle of a field is equivalent to s Left winding of virtual axis of domain z Unit circle of a field (s The system is stable on the left pole of the system ). analysis z Amplitude frequency response in domain (IIR The phase nonlinearity is not shown here ) It's on the unit circle ,z=r*exp(jw), The module value on the unit circle is 1, therefore z=exp(jw)(e Of j*w pow ), According to Euler formula exp(jw)
= cos(w)+j*sin(w), We get it Eq(3). We can use it matlab To find out conveniently H(w) Amplitude frequency response , The code will be given later , Let's take a look at the results, see figure 2.
When q And sampling time 1 When consistent (q=0.0565
fs=3.333k Namely 300us), The amplitude frequency response is shown in Fig 2, The abscissa is 30hz The amplitude is 0 0.708 Approximately equal to 0.707(-3dB spot ), Let's briefly analyze the figure below 2, Passband of first order low pass filter .... forehead .. It looks narrow in the picture , Moreover, the difference between the unevenness and the ideal first-order low-pass filter is obvious , But for high frequency interference suppression effect is obvious , And it's easy to implement , Many SCM applications will use this filter .
chart 2
chart 5 It is the time domain result of simulation , The black line is the ideal signal , The red line is a noisy signal , The blue line is the denoised signal , Because the first-order low-pass filter is used, the signal waveform is close to the ideal waveform , So the picture 3 It's not very clear . chart 4 It is a partial sketch of the result , In this way, the ideal signal can be seen clearly , The signal with noise before filtering and after filtering “ clean ” Time domain waveform of signal .
chart 3
chart 4
code :
% name : Digital first order low pass filter clc; clear; close all; t=0.0003; % The sampling period is 300us fs = 1/t; % sampling frequency w =
-3.14:0.001:3.14; % Abscissa resolution ,z Field unit circle w by +-pi q=0.0565; % coefficient f =
(q*cos(w)+q*1i*sin(w))./(cos(w)-(1-q)+1i*sin(w));% transfer function am=abs(f); % Find the amplitude
w=w*(fs/2/pi); %z field w And sampling frequency conversion plot(w,am); % Allowable amplitude frequency response curve
xlabel('Frequency(Hz)','fontsize',17); ylabel('Amplitude','fontsize',17);
%%%%%%%% signal processing tt = 0:0.0003:25; y_ideal = sin(0.5*tt); % Ideal signal y_noise =
awgn(y_ideal,35); % Noisy signal y_proce = y_noise; % Signal after drying n=length(y_proce); for i=2:n
y_proce(i) = q *y_noise(i) + (1-q)*y_proce(i-1); end figure(2);
plot(tt,y_noise,'r');hold on; plot(tt,y_ideal,'k','lineWidth',2); hold on;
plot(tt,y_proce,'b'); hold on; xlabel('Time(s)'); ylabel('Amp(v)');
Technology