Hi there
Recently I tested a circuit and I just get S-parameters [in Mag (dB) and Phase (Deg.)]...now I want to plot Group Delay, and I don't know how to use Matlab's code to do that...
If you want to do this numerically, then you could approximate the derivative using finite differences. As a simple example, let's assume Phi = sin(w). Then, the matlab code would be something like this:
Code:
close all; clear all; clc;
% Define some values for w
w = (0:999)*0.01;
% Define Phi
Phi = sin(w);
% Compute differences
dPhi = diff(Phi);
dw = diff(w);
% Approximate -dPhi/dw
result = -dPhi./dw;
% Plot Phi and -dPhi/dw
plot(w, Phi);
hold on;
plot(w(1:end-1) ,result, 'r');
legend('Phi', '-dPhi/dw');
I think it would be far better to differentiate Phi analytically, but I guess this may not be possible.