Gs = 10/((1+10*s)*(1+2*s));
omVALS = logspace(-10,6, 1e4);
% We want to evaluate the frequency response at 10000
% angular pulsation values between 10^-10 and 10^6 rad/s.
% The greater the number of angular pulsation values
% used to evaluate the frequency response, the better
% the accuracy of the diagram.
Bcolors = [0 0.4470 0.7410; ...
0.9290 0.6940 0.1250; ...
0.4940 0.1840 0.5560; ...
0.4660 0.6740 0.1880; ...
0.3010 0.7450 0.9330; ...
0.8500 0.3250 0.0980; ...
0.6350 0.0780 0.1840]; % some different colors
% for the actual diagrams
hf = figure('Units','centimeters','Position',[0.01, 0.01, 26, 20]);
drawPolarDiagramFreqResp(Gs, omVALS, Bcolors(1, :), 2.5, '-', 6, [], hf, true);
xiVAL = [0.1, 0.3, 0.5, 0.7, 0.9]; % the damping factor values
Nxi = numel(xiVAL); % how many damping factors?
% let's preallocate a data-structure for storing the different transfer functions
% generate the transfer functions, with different damping factors
numGs = 25; % the coeffs of the polynomial at the numerator in G(s)
denGs = [ (1) (10*xiVAL(n)) 25];
% the coeffs of the polynomial at the denominator in G(s),
Gs_xi{n} = tf(numGs, denGs); % let's define the transfer function G(s)
% and store it in the data-structure
omVALS = logspace(-10,4, 1e4);
% We want to evaluate the frequency response at 10000
% angular pulsation values between 10^-10 and 10^4 rad/s.
% The greater the number of angular pulsation values
% used to evaluate the frequency response, the better
% the accuracy of the plot.
% let's create the diagrams: we need to store the handler of the figure
% refer to the help of drawPolarDiagramFreqResp( )
Bcolors = [0 0.4470 0.7410; ...
0.9290 0.6940 0.1250; ...
0.4940 0.1840 0.5560; ...
0.4660 0.6740 0.1880; ...
0.3010 0.7450 0.9330; ...
0.8500 0.3250 0.0980; ...
0.6350 0.0780 0.1840]; % some different colors
% for the actual diagrams
hf = figure('Units','centimeters','Position',[0.01, 0.01, 24, 28]);
%t = tiledlayout(2, 3); % let's create rooms for plots in a 3x3 grid
% nextile(1); % % let's move to tile 1
hax = drawPolarDiagramFreqResp(Gs_xi{n}, omVALS, ...
Bcolors(n, :), 1.5, '-', 6, 5, hf, false);
legend(hax, ['$\xi = ',num2str(xiVAL(1)),'$'], '', '', '',...
['$\xi = ',num2str(xiVAL(2)),'$'], '', '', '',...
['$\xi = ',num2str(xiVAL(3)),'$'], '', '', '',...
['$\xi = ',num2str(xiVAL(4)),'$'], '', '', '',...
['$\xi = ',num2str(xiVAL(5)),'$'], '$\omega =0$', '$\omega \to \infty$' ,...
'$\omega =5$', 'Interpreter','latex', 'fontsize',14, 'Location', 'best');
s = tf('s'); % the transfer function building helper
Gs = (s+10)/(s * (1+s) );
omVALS = logspace(-2,3, 5e4); % <-- Modify this interval and see what the plot looks like.
% We want to evaluate the frequency response at 50000
% angular pulsation values between 10^-2 and 10^3 rad/s.
% The greater the number of angular pulsation values
% used to evaluate the frequency response, the better
% the accuracy of the diagram.
% let's create the diagrams: we need to store the handler of the figure
% refer to the help of drawPolarDiagramFreqResp( )
Bcolor = [0 0.4470 0.7410]; % a different color for the actual diagram
hf = figure('Units','centimeters','Position',[0.01, 0.01, 24, 28]);
hax = drawPolarDiagramFreqResp(Gs, omVALS, ...
Bcolor, 2.5, '-', 6, [], hf, false);
legend(hax, '$G(j \omega)$', '', '$\omega \to \infty$' ,...
'Interpreter','latex', 'fontsize',14, 'Location', 'best');
rmpath(genpath("BodeDiagram"))