Info

This question is closed. Reopen it to edit or answer.

Using find() instead of tracing a plot

1 view (last 30 days)
Andrew
Andrew on 8 Jul 2014
Closed: MATLAB Answer Bot on 20 Aug 2021
I'm working on a lab assignment, and I was wondering how I could use the find() function instead of tracing a plot. Tracing the resulting plot in figure one gives 0.4473 (on the X axis) at -20.11 dB (on the Y axis), but I wanted to find a way to obtain the exact value at -20. Is there a way to do this?
My code is as follows:
b1=[1,1];
b1_1=[0.5,-1];
b2=conv(b1,b1);
b3=conv(b2,b2);
b3_1_1=conv(b3,b1_1);
b=0.02426*b3_1_1;
a1=[1,-1.0416,0.4019];
a2=[1,-0.5661,0.7657];
a3=[1,-0.5];
a1_2=conv(a1,a2);
a=conv(a1_2,a3);
w=0:pi/1024:pi;
h=freqz(b,a,w);
%figure; plot(w/pi,abs(h))
figure; plot(w/pi,20*log(abs(h)));
grid on;
xlabel('Normalized digital frequency ')
ylabel('Magnitude in dB')
title('Magnitude Response')
figure; plot(w/pi,angle(h))
grid on;
xlabel('Frequency ')
ylabel('Amplitude')
title('Phase Response')
find(20*log(abs(h))==-20.00)
figure; grpdelay(b,a)
axis([0,0.4473,2,10]);
Thanks in advance!

Answers (0)

Community Treasure Hunt

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

Start Hunting!