Plot Group Delay using Matlab with S-prameters

Status
Not open for further replies.

sayyedjamal

Junior Member level 3
Joined
Feb 28, 2013
Messages
27
Helped
2
Reputation
6
Reaction score
2
Trophy points
1,283
Location
Iran
Activity points
1,442
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...

Could anybody help me?

Thx
 

It's -dPhi/dw, I have Phi and w as two vector...
 

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.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…