help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

octave and FIR plotting anomaly


From: Alfred Liin
Subject: octave and FIR plotting anomaly
Date: Mon, 19 May 2014 22:58:35 +0300

Hello.

i have made a script to plot highpass and lowpass FIR filter frequency response (code is in the end of the mail). It used to give me the plot attached (madal_ja_korgpaas_koos4.jpeg)

Now, i think there has been some update to octave and when copy-pasting the same code, i get another result (not as pretty graph - attached as Graph_problem.jpeg)

Can you explain what is the problem? Which graph is correct?
Also, in Octave i get the following warning:
warning: using continuation marker \ outside of double quoted strings is deprecated and will be removed in a future version of Octave; near line 59 of file '/usr/share/octave/packages/signal-1.2.2/fir2.m'

octave:209> version
ans = 3.8.1

There are some unusual characters in my language that octave is no longer able to plot, but that is not the main problem. The main thing is that highpass filter has a different response in the new graph.

Can you please check out the code:
Alfred.
 
b4=fir2 (100, [0,1/12,1/12,1], [1,1,0,0], 2^24, 2, blackman(101));
save b4_blackman_coefficents.mat b4;
b4_high=-b4;
b4_high(51)=b4_high(51)+1;
figure(1);
plot(b4_high, 'r'); hold on;

title(strcat('K',char(245),'rgp', char(228), char(228), 'sfiltri FIR koefitsendid'));
xlabel(strcat('V',char(245),'endi number')); ylabel('FIR filtri koefitsent');
legend({"Spektraalselt inverteeritud sinc"}); legend("location", "northeast");
axis([0, 101, -0.1,1]);
hold off;
[H4,w4]=freqz(b4);
[H4_high,w4_high]=freqz(b4_high);
figure(2);
subplot(3,1,1);

plot(w4/pi,20*log10(abs(H4)),'r');
hold on;
plot(w4_high/pi,20*log10(abs(H4_high)),'g');
plot(w4/pi,20*log10((abs(H4)+abs(H4_high))/1),'b');
title('Sageduskarakteristikud H\(\omega\)'),
ylabel('Amplituud [dB]'),
legend({strcat('Madalp',char(228), char(228), 'sfilter (suurendatuna)'), strcat('K',char(245), 'rgp', char(228), char(228), 'sfilter(suurendatuna)'),"Kahe filtri summa" });
legend("location", "east");
axis([0, 1, -10,0.85]);

subplot(3,1,2);
plot(w4/pi,20*log10(abs(H4)),'r');
hold on;
plot(w4_high/pi,20*log10(abs(H4_high)), 'g');
%plot(w4/pi,20*log10((abs(H4)+abs(H4_high))/1),'b');
title('Sageduskarakteristikud H\(\omega\)');
ylabel('Amplituud [dB]');
legend({strcat('Madalp',char(228), char(228), 'sfilter'), strcat('K',char(245), 'rgp', char(228), char(228), 'sfilter'),"Kahe filtri summa"});
legend("location", "east");
axis([0, 1, -100,10]);


subplot(3,1,3);
plot(w4/pi,(unwrap (arg (H4))*360/(2*pi)),'r');
hold on;
plot(w4_high/pi,(unwrap (arg (H4_high))*360/(2*pi)),'g');
title('Faasikarakteristikud \Phi(\omega)');
ylabel(strcat('Faas [',char(176),']'));
xlabel ("Normaliseeritud sagedus [\Pi*rad]");
legend ({strcat('Faas (',char(176), '-ides): Madalp', char(228), char(228), 'sfilter'), strcat('K',char(245), 'rgp', char(228), char(228), 'sfilter')}, "location", "east");
hold off;

Attachment: madal_ja_korgpaas_koos4.jpeg
Description: JPEG image

Attachment: Graph_problem.jpeg
Description: JPEG image


reply via email to

[Prev in Thread] Current Thread [Next in Thread]