Azzera filtri
Azzera filtri

Designfilt and crossover filters?

6 visualizzazioni (ultimi 30 giorni)
Darsana P M
Darsana P M il 16 Mar 2017
Commentato: Star Strider il 24 Mar 2017
Can anybody help me with an alternative function for DesignFilt and crossover filters. These functions work only with matlab 2016. it doesn't work in matlab 2013. What is the alternative function?

Risposta accettata

Star Strider
Star Strider il 16 Mar 2017
In R2013a, see the documentation on fdatool (link) and the other functions such as fdesign (link) that appear in the same documentation page.
  8 Commenti
Darsana P M
Darsana P M il 17 Mar 2017
Modificato: Star Strider il 17 Mar 2017
Can you please explain it once again. Is this the code that i must use?? But i got an error in the for loop part??
Fs = 8200; % Samping Frequency (Hz)
Fn = Fs/2; % Nyquist Frequency
pf = linspace(20,4000,17); % Passband Frequencies
cf = pf(1:end-1)+(pf(2)-pf(1))/2; % Centre Frequencies
for k1 = 1:length(cf)
[z(k1,:),p(k1,:),k(k1)] = butter(7, [pf(k1) pf(k1+1)]/Fn);
[sos{k1},g{k1}] = zp2sos(z(k1,:),p(k1,:),k(k1));
[h(k1,:),w(k1,:)] = freqz(sos{k1},512,Fs);
end
figure(1)
plot(w([1 16],:), abs(h([1 16],:)))
grid
% axis([0 0.2 ylim])
figure(2)
freqz(sos{1})
hold on
for k1 = 2:16
freqz(sos{k1})
end
hold off
Star Strider
Star Strider il 17 Mar 2017
You will need to change the code to design the filters that meet your requirements. Use your own sampling frequency, and define your filter passband frequencies in a vector and assign them to the ‘pf’ variable. You might be able to use the linspace call with only minor modifications. The rest of my code should work without any need to change it.
I ran that code just now and it ran for me without error (in R2017a, the code was written in R2015a). What error did you see? Please copy the entire red text of the error from the Command Window and paste it to a comment here.

Accedi per commentare.

Più risposte (2)

Darsana P M
Darsana P M il 17 Mar 2017
Error using vertcat Dimensions of matrices being concatenated are not consistent.
Error in zp2sos>orderp (line 247) new_p = [p_conj;p_real];
Error in zp2sos (line 94) [new_p,p_conj,p_real] = orderp(p_conj,p_real);
Error in band8 (line 7) [sos{k1},g{k1}] = zp2sos(z(k1,:),p(k1,:),k(k1));
This is the error that i obtained. I tried it in matlab 2013a
  10 Commenti
Darsana P M
Darsana P M il 19 Mar 2017
Ok...Thanks a lot
Star Strider
Star Strider il 19 Mar 2017
My pleasure.

Accedi per commentare.


Darsana P M
Darsana P M il 22 Mar 2017
Fs = 8200; % Samping Frequency (Hz)
Fn = Fs/2; % Nyquist Frequency
pf = [20 100:100:2E+4] % Passband Frequencies
cf = pf(1:end-1)+(pf(2)-pf(1))/2; % Centre Frequencies
for k1 = 1:length(cf)
[z(k1,:),p(k1,:),k(k1)] = butter(7, [pf(k1) pf(k1+1)]/Fn);
[sos{k1},g{k1}] = zp2sos(z(k1,:),p(k1,:),k(k1));
[h(k1,:),w(k1,:)] = freqz(sos{k1},512,Fs);
end
figure(1)
plot(w([1 16],:), abs(h([1 16],:)))
grid
% axis([0 0.2 ylim])
figure(2)
freqz(sos{1})
hold on
for k1 = 2:16
freqz(sos{k1})
end
hold off
I wrote the pf command as you said. pf=[20 100:100:2E+4]. But i got an error saying
the cut off frequencies must be within the interval (0,1); line 57
[z(k1,:),p(k1,:),k(k1)] = butter(7, [pf(k1) pf(k1+1)]/Fn); line 7
This was done to get a similar graph as shown in figure?? What will i do?
  4 Commenti
Darsana P M
Darsana P M il 24 Mar 2017
Thanks a lot
Star Strider
Star Strider il 24 Mar 2017
My pleasure.

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by