Filtering a set of recorded data

조회 수: 5(최근 30일)
Jared Martin 2015년 4월 21일
답변: Youssef Khmou 2015년 4월 21일
Filtering a set of recorded data is a constant occurrence in just about any engineering discipline. For problem 2, the students will read data from a given file, filter the data with Equation 3 and then store the filtered data results along with the original data into an output file. For reference, the filter found in Equation 3 is known as a moving average filter and fall into the more general class of Finite Impulse Response (FIR) Filters.
Y[n]= (1/N) summation from k=0 to N-1 for X[n-k]
where:
X[n] = Is the input data from the file Y[n] = Is the filtered output data N=50,000
This Program should perform at least the following functions: 1. The program should display a title banner which has the title of FIR Filter Problem and some brief text that explains the functionality of the program. 2. Read in data from the given data file and store into an array. 3. Filter the data with Equation 3 and generate output values Y [n] For N = 100. 4. Open a file for output, and write the original data with the filtered data in columns. (a) Remember that writing two data values on a line can be done with, save myDataFileName.txt myVar -ASCII; 5. Open the file that your program created in Matlab and plot the original data with the filtered data on the same plot versus the sample number n. (a) The plot should be properly labeled with a title and x,y axis labels. The x axis label should be Samples, and the y axis label should be Recorded Data.
댓글 수: 1표시숨기기 없음
Guillaume 2015년 4월 21일

댓글을 달려면 로그인하십시오.

답변(1개)

Youssef Khmou 2015년 4월 21일
The important part of the problem is the implementation of MA filter, here is an example of 6 points window,
fs=80;
t=0:1/fs:2-1/fs;
f=5;
x=1.5*sin(2*pi*f*t).*cos(-1.1*t);
y=x+0.6*randn(size(t));
N=6;
K=length(y);
for n=N+1:K
s=0;
for p=n:-1:n-N
s=s+y(p);
end
z(n)=s/N;
end
there is a specific built-in function that performs the above code, try to find how to design the coefficient vectors.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by