Hello everyone,
I intend to use freqz() function I need to plot the magnitude for different border frequencies. But first I need to determine the cut off frequencies.
I used this code but which seems to not give me even a close response to this
%% INitializing Matlab Environment
close all; clc;clearvars;%% 1.1
b=log10(8000);%stop frequency and 100Hz is the pass frequency
yc1=logspace(2,b,23);yd=stem(yc1);grid onxlabel('Borders','FontSize',12);ylabel('F (Hz)','FontSize',12);set(gca,'YScale', 'log')%%
m={};n={};h={};ph={};j={};fs=21e3 %sampling frequency
for i= 1:1:23 [u,o] = butter(1,[2*100/fs, (2*yc1(i))/fs],'bandpass'); m{i}=u; n{i}=o; %freqz(m{i},n{i});
[h{i},ph{i}]=freqz(m{i},n{i}); figure subplot(2,1,1) hold on plot(ph{i},20*log10(abs(h{i}))); end hold offgridset(gca,'XLim',[0 1e4],'XTick',10.^(0:4),'YLim',[-12 0],'YTick',-12:2:0,'XScale', 'log')
Any Idea on what I am missing ?
Best Answer