How to create a 2-D plot to validate filter characteristics ?

S
Shaun Sloan · Mar 28, 2024 · 2K views
Question
I am running a test signal (white noise) through filter so that i can validate the frequency response and magnitude.   Below is the code I'm using to test the filter   %Test 1 Fs = 44100 x = randn(1,44100); % Signal = randn (fs*dur,1) shall generate 1 channel signal with certain sampling frequency and duration [b1,a1]=fourbandEQ(30,0,1, 300,0,1, 1000,0,1, 5000,0,1, Fs); y = filter (b1,a1,x); % y = filter(b,a,X) Y is output signal, X is input signal, b is array of %denominator coefficients , a is numerator  
Expert Answer
Profile picture of Neeta Dsouza
Neeta Dsouza PhD Expert
Answered Aug 12, 2026

I can’t run your code, but the easiest way to plot the transfer function is to divide the fft of the output by the fft of the input, then do the appropriate plots:

 

Fn = Fs/2;
tf = fft(y)./fft(x);
Fv = linspace(0, 1, length(tf)/2+1)*Fn;
Ix = 1:length(Fv);

figure(1)
subplot(2,1,1)
plot(Fv, abs(tf(Ix)))
grid
ylabel('Amplitude')

subplot(2,1,2)
plot(Fv, angle(tf(Ix)))
grid
xlabel('Frequency')
ylabel('Phase')

 

100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!