function phase = ph(params,freq)
% This function computes the phase of an analog allpass network with 2 legs and N sections.
% The phase is evalutated at the set of frequencies given in the vector: freq.
% function phase = ph(params,freq)
%
% Inputs:
% params (Nx2)	Matrix of parameters (1/RC for 2 legs and N sections)
% freq	(1xM)	frequency vector (in Hz)
% 
% Output:
% phase	(2xM)	output phase vector in deg.

[N,L] = size(params);
[dummy,M] = size(freq);

temp = zeros(N,2*M);		% set array size
%temp(:) = 180 - (360/pi)*atan(2*pi*(1./(10.^params(:)))*freq);	% compute phase matrix
temp(:) = (360/pi)*atan(2*pi*(1./(10.^params(:)))*freq);	% compute phase matrix (ignor the fact that each stage inverts signal)
phase = zeros(2,M);			% set array size
phase(:) = sum(temp,1);		% sum up the phase over N cascaded sections
return


Sable
github-repos/MATLAB/Sable-mcbench-benchmarks/mcbench-benchmarks-ba13b2f0296ef49491b95e3f984c7c41fccdb6d8/73-phshift/phfunc.m
mcbench-benchmarks
github-repos/MATLAB/Sable-mcbench-benchmarks
ba13b2f0296ef49491b95e3f984c7c41fccdb6d8