Plot Bode diagrams from the given closed loop system frequency responses in the table

I am stuck here, I am able to plot the bode diagram from a TF and yet given closed loop system frequency responses I get stumped. Is there a video or link where I can learn more about coding these types of Bode diagrams?

2 Comments

Please type out the data, and provide the formulas for the Bode plot. The task should be relatively easy.
I ended up using the following method to obtain the Bode Plot
% Clear and close all figures and variables
clear all; close all; clc;
% Define given experiment frequency response data
% Define experimental frequency points (in rad/s)
frequencies = [10000 1.0308e+04 1.2054e+04 1.4096e+04 1.6484e+04 1.9276e+04 2.2541e+04 2.6360e+04 3.0825e+04 3.6046e+04 4.2152e+04 4.9292e+04 5.7641e+04 6.7405e+04 7.8823e+04 9.2175e+04 100000 1.0779e+05 1.2005e+05 1.3500e+05 1.4978e+05 1.6422e+05 1.7816e+05 1.9149e+05 2.0412e+05 2.1759e+05 2.3387e+05 2.5373e+05 2.7818e+05 3.0864e+05 3.4707e+05 3.7691e+05 4.4076e+05 5.1542e+05 6.0272e+05 7.0482e+05 8.2420e+05 9.6381e+05 1000000 1.1271e+06 1.3180e+06 1.5412e+06 1.8023e+06 2.1076e+06 2.4646e+06 2.8821e+06 3.3703e+06 3.9411e+06 4.6087e+06 5.3894e+06 6.3023e+06 7.3698e+06 8.6182e+06 10000000];
% Define system output magnitudes A_o at corresponding frequencies
magnitudes = [10.0135 10.0144 10.0196 10.0269 10.0368 10.0503 10.0689 10.0943 10.1293 10.1773 10.2434 10.3345 10.4606 10.6358 10.8801 11.2226 11.4527 11.7038 12.1432 12.7459 13.3949 14.0372 14.5954 14.9805 15.1185 14.9411 14.2493 12.8606 10.8411 8.5495 6.3902 5.1965 3.5394 2.4476 1.7163 1.2168 0.8698 0.6256 0.5793 0.4520 0.3276 0.2380 0.1732 0.1263 0.0921 0.0672 0.0491 0.0359 0.0262 0.0192 0.0140 0.0102 0.0075 0.0056];
% Define system output phase shifts φ_o at corresponding frequencies (degrees)
phases = [-1.7215 -1.7747 -2.0765 -2.4302 -2.8450 -3.3319 -3.9043 -4.5785 -5.3748 -6.3185 -7.4427 -8.7906 -10.4217 -12.4199 -14.9089 -18.0793 -20.0954 -22.2383 -25.9347 -31.0784 -37.0062 -43.7533 -51.2698 -59.3831 -67.7922 -77.2447 -88.7365 -101.7827 -115.2116 -127.6625 -138.2902 -144.0139 -152.0947 -157.7617 -161.9207 -165.0911 -167.5801 -169.5783 -169.9920 -171.2094 -172.5573 -173.6815 -174.6252 -175.4215 -176.0957 -176.6681 -177.1550 -177.5698 -177.9235 -178.2253 -178.4830 -178.7032 -178.8913 -179.0446];
% Convert magnitude to decibels for the Bode magnitude plot
magnitudes_dB = 20*log10(magnitudes);
% Plot Bode Magnitude (Gain) plot
subplot(2, 1, 1);
semilogx(frequencies, magnitudes_dB, 'b');
grid on;
title('Bode Diagram - Magnitude');
xlabel('Frequency (rad/s)');
ylabel('Magnitude (dB)');
% Plot Bode Phase plot
subplot(2, 1, 2);
semilogx(frequencies, phases, 'r');
grid on;
title('Bode Diagram - Phase');
xlabel('Frequency (rad/s)');
ylabel('Phase (degrees)');

Sign in to comment.

Answers (2)

If you store the data in a frd object, then we can use toolbox functions to make the plot and save some code
% Define given experiment frequency response data
% Define experimental frequency points (in rad/s)
frequencies = [10000 1.0308e+04 1.2054e+04 1.4096e+04 1.6484e+04 1.9276e+04 2.2541e+04 2.6360e+04 3.0825e+04 3.6046e+04 4.2152e+04 4.9292e+04 5.7641e+04 6.7405e+04 7.8823e+04 9.2175e+04 100000 1.0779e+05 1.2005e+05 1.3500e+05 1.4978e+05 1.6422e+05 1.7816e+05 1.9149e+05 2.0412e+05 2.1759e+05 2.3387e+05 2.5373e+05 2.7818e+05 3.0864e+05 3.4707e+05 3.7691e+05 4.4076e+05 5.1542e+05 6.0272e+05 7.0482e+05 8.2420e+05 9.6381e+05 1000000 1.1271e+06 1.3180e+06 1.5412e+06 1.8023e+06 2.1076e+06 2.4646e+06 2.8821e+06 3.3703e+06 3.9411e+06 4.6087e+06 5.3894e+06 6.3023e+06 7.3698e+06 8.6182e+06 10000000];
% Define system output magnitudes A_o at corresponding frequencies
magnitudes = [10.0135 10.0144 10.0196 10.0269 10.0368 10.0503 10.0689 10.0943 10.1293 10.1773 10.2434 10.3345 10.4606 10.6358 10.8801 11.2226 11.4527 11.7038 12.1432 12.7459 13.3949 14.0372 14.5954 14.9805 15.1185 14.9411 14.2493 12.8606 10.8411 8.5495 6.3902 5.1965 3.5394 2.4476 1.7163 1.2168 0.8698 0.6256 0.5793 0.4520 0.3276 0.2380 0.1732 0.1263 0.0921 0.0672 0.0491 0.0359 0.0262 0.0192 0.0140 0.0102 0.0075 0.0056];
% Define system output phase shifts φ_o at corresponding frequencies (degrees)
phases = [-1.7215 -1.7747 -2.0765 -2.4302 -2.8450 -3.3319 -3.9043 -4.5785 -5.3748 -6.3185 -7.4427 -8.7906 -10.4217 -12.4199 -14.9089 -18.0793 -20.0954 -22.2383 -25.9347 -31.0784 -37.0062 -43.7533 -51.2698 -59.3831 -67.7922 -77.2447 -88.7365 -101.7827 -115.2116 -127.6625 -138.2902 -144.0139 -152.0947 -157.7617 -161.9207 -165.0911 -167.5801 -169.5783 -169.9920 -171.2094 -172.5573 -173.6815 -174.6252 -175.4215 -176.0957 -176.6681 -177.1550 -177.5698 -177.9235 -178.2253 -178.4830 -178.7032 -178.8913 -179.0446];
h = frd(magnitudes.*exp(1j*phases*pi/180),frequencies);
bodeplot(h)

Categories

Products

Asked:

on 26 Sep 2024

Commented:

on 30 Sep 2024

Community Treasure Hunt

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

Start Hunting!