[23f8f0]: comp / comp_transferfunction.m  Maximize  Restore  History

Download this file

37 lines (27 with data), 836 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
function H=comp_transferfunction(g,L)
%COMP_TRANSFERFUNCTION Compute the transfer function
l=(0:L-1).'/L;
if isfield(g,'h')
g_time=circshift(postpad(g.h,L),g.offset);
if isfield(g,'fc')
g_time = g_time.*exp(2*pi*1i*round(g.fc*L/2)*l);
end
if isfield(g,'realonly') && g.realonly
g_time=real(g_time);
end;
H=fft(g_time);
elseif isfield(g,'H')
if ~isnumeric(g.H)
g.H=g.H(L);
g.foff=g.foff(L);
end;
H=circshift(postpad(g.H,L),g.foff);
if isfield(g,'delay')
H = H.*exp(-2*pi*1i*round(g.delay)*l);
end
if isfield(g,'realonly') && g.realonly
H=(H+involute(H))/2;
end;
else
error('%s: Unrecognized filter format. The struct should have either .h or .H field.',upper(mfilename));
end;

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks