How do I plot a filtered wav file?
2 次查看(过去 30 天)
显示 更早的评论
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
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
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');
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Pulsed Waveforms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!