Write transfer function in Matlab for bode plot

Ming Sun

Ming Sun / October 27, 2022

1 min read––– views

The following Matlab script will plot a bode plot of two pole system.

clc; clear; close all;

s = tf('s');                        % define the variable s as a transfer function of value s
Q = 2;                              % define Q factor
w0 = 2*pi*1000;                     % define corner frequency
G = 10/(1+s/(w0*Q)+(s/w0)^2);       % Define G as a transfer function as shown
h = bodeplot(G);                    % Plot the Bode plot of G(s)
setoptions(h, 'FreqUnits', 'Hz');   % change frequency scale from rad/sec to Hz
set(findall(gcf,'type','line'),'linewidth',2)
grid on;
Bode plot
Fig. 1Bode plot[1]

References and materials

[1] tf - Transfer function model

[2] bodeplot.m


HomeWikis
SnippetsAbout
Google ScholarLinkedIn