필터 지우기
필터 지우기

How do I plot a filtered wav file?

조회 수: 2 (최근 30일)
James Andrew
James Andrew 2018년 4월 10일
댓글: Jan 2023년 3월 1일
I have a wav file and I know how to plot that. But then I was given a series like y[n]=x[n]-x[n-5]. I don't want to type the real one b/c I want to do this on my own.
I just would to know how to implement this kind of filter to matlab. Like how do I type y[n]=x[n]-x[n-5] to get an output plot?
  댓글 수: 1
Jan
Jan 2023년 3월 1일
I'm not sure, what the question is. What does "type the real one b/c" mean? What do you want to implement by your own? What have you tried so far and which problems occur?
Do you want to implement the filter using the command filter, or do you prefer a loop? What exactly does "get an output plot" mean?

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

답변 (1개)

Sufiyan
Sufiyan 2023년 3월 1일
Hello,
You can refer to the code below to get an output plot. In the code shown below, coefficients of output y are a=1(y[n]) and coefficients of x are (x[n], x[n-5]) =>(1,-1). Other coefficients are replaced with zeros as there are no other terms of x (x[n-1],x[n-2]…x[n-4])in the equation.
N = 1000; %no of samples
x = randn(N, 1);
b = [1 0 0 0 0 -1];% x coefficients
a = 1; %y coefficients
y = filter(b, a, x);
n = 1:N;
figure;
plot(n, x, 'b', n, y, 'r');
legend('Input', 'Output');
xlabel('Sample index');
ylabel('Amplitude');
you can refer to filter in the documentation.

카테고리

Help CenterFile Exchange에서 Pulsed Waveforms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by