Complex Coefficient Filter bode plot

17 visualizaciones (últimos 30 días)
GonzElo
GonzElo el 29 de Dic. de 2011
How to obtain the bode plot for a transfer function with complex coefficients in Matlab?, i.e. gain and phase for positive and negative frequencies.

Respuestas (2)

GonzElo
GonzElo el 4 de En. de 2012
Craig, thank you for your help. It's a good way of reuse the bode command that works only for positive frequencies.
I solved my problem of seeing the frequency response, first realising that logaritmic scale for negative frequencies makes no sense, and that the bode diagram shows the modulus and phase of the complex number that transfer function represent. So, i evaluated both for different frequencies, but plotting them in linear axes.
This is for two complex transfer functions:
f=[-1000:1:1000]; %Vector of frequencies [Hz]
w=2*pi*f; %Vector of frequencies [rad]
WC=2*pi*50; %Parameters of filter
WO=2*pi*50;
f1=(WC+1i*0)./(1i*w-1i*WO+WC); %Complex filters
f2=(WC+1i*0)./(1i*w+1i*WO+WC);
AMP_f1=abs(f1); %Evaluation of modulus
AMP_f2=abs(f2);
ANG_f1=angle(f1)*(180/pi); %Evaluation of phase (changed to degrees)
ANG_f2=angle(f2)*(180/pi);
close all
figure
subplot(2,1,1),plot(f,AMP_f1,f,AMP_f2),grid on
xlabel('Frequency [Hz]')
ylabel('Gain')
subplot(2,1,2),plot(f,ANG_f1,f,ANG_f2),grid on
xlabel('Frequency [Hz]')
ylabel('Phase [º]')

Craig
Craig el 4 de En. de 2012
You could try this as a workaround
a = tf(1,[1,i]) % Complex tf
wp = logspace(-2,2,100); % Freq vector
hpos = freqresp(a,wp); % Get Positive freq response
hneg = freqresp(a,-wp); % Get Negative freq response
% Put them into an frd, Note both are done with a positive frequency vector
frdpos = frd(hpos,wp);
frdneg = frd(hneg,wp);
% Plot bode of two responses (note second response is negative frequency
bode(frdpos,frdneg)
Or you can you the data to make your own plot.
-craig

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by