4) Implement the Bode plot from the previous homework in a GUI based program.

20 0

Get full Expert solution in seconds

$1.97 ONLY

EXPERT ANSWER

The required code and test output are given below:-

CODE:-

clc
clear all

M = csvread(‘bode.txt’);
% Get each column data into separate arrays
freq = M(:,1);
amp_db = 20*log10(M(:,2));
phase = M(:,3);
% Create subplots for amplitude and frequency
subplot(2,1,1);
semilogx(freq, amp_db,’LineWidth’,3);
title(‘Bode Diagram’)
ylabel(‘Amplitude (dB)’)
grid on

subplot(2,1,2);
semilogx(freq, phase,’LineWidth’,3);
ylabel(‘Phase (Rad)’)
xlabel(‘Frequency (Hz)’)
grid on

Sample

data used to test the code

10,1,0
50,1,0
100,0.8,0
400,0.7,-0.1
800,0.6,-0.2
1000,0.5,-0.4
10000,0.5,-0.5
100000,0.3,-1

TEST OUTPUT:-