I am trying to plot the frequency response of a transfer function without the use of tf and bode.

8 views (last 30 days)
I have a transfer function in the s domain for which I have calculated the elements needed for the frequency response and have sketched the plot so I know how it should look. I have calculated the j-omega component. I could easily use tf and bode and get the plot but the challenge is that I cant use those functions and must accept a vector of frequencies for which to plot this. Just wanted to know a good approach to tackling this and achieving the same plot.

Answers (1)

Birdman
Birdman on 13 Feb 2018
One way to do it is symbolically. Change the transfer function and see the results:
syms s
Gs=1/(s+1);
x=logspace(-2,2);
GsF=vpa(subs(Gs,s,x*1i),3);
GsFAbs=abs(GsF);
GsFMag=20*log10(GsFAbs);
subplot(2,1,1);
semilogx(x,GsFMag);xlabel('Frequency(rad/sec)');ylabel('Magnitude(dB)');title("Frequency response for "+string(Gs))
set(gca,'XLim',[0 max(x)]);
subplot(2,1,2);
GsFPh=angle(GsF)*180/pi;
semilogx(x,GsFPh);xlabel('Frequency(rad/sec)');ylabel('Phase(deg)');
set(gca,'XLim',[0 max(x)]);

Community Treasure Hunt

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

Start Hunting!