Hartogs - Hughes algorithm

Hey Everyone,
Considering the following impulse response:
h(t) = a1δ(t − D1) + a2δ(t − D2) + a3δ(t − D3) + a4δ(t − D4)
with a and D known, how do I impute this impulse response in MATLAB and do I calculate H(f). There is also a random phase uniformly distributed between 0 and 2π.
The purpose of this is to compute the attenuation values Ai = 1/|H^|2 and plotting the attenuation profile in dB.
I have this code but it's not plotting properly, what might be the problem:
% Set parameters
D = [1, 1.01, 1.015, 1.02];
a = [1, 0.5, 0.9, 0.3];
h = zeros(1, 128); % Initialize h as an array of size 1x1
N=128;
% Generate impulse response
for i = 1:4
% Generate a random phase between 0 and 2pi
phase = rand * 2*pi;
% Convert the phase to a complex number
a_complex = cos(phase) + 1i*sin(phase);
h = h + a(i) * a_complex * delta(t - D(i));
end
% Compute H and Hi
H = fft(h);
f = (0:1:127);
% Compute Ai
Ai = 1./abs(H).^2;
% Compute attenuation in dB
attenuation_db = 10*log10(Ai);
% Plot attenuation profile
figure(1);
scatter(f, attenuation_db, 'bo')
title('Attenuation')
xlabel('f')
ylabel('Att(dB)')

回答(1 个)

0 个投票

As given in your formulation, is this Dirac delta fcn with a few different time delays t1, t2, t3. If so, you can consider using dirac() and heaviside() - see DOC1 and DOC2.

类别

帮助中心File Exchange 中查找有关 Signal Generation, Analysis, and Preprocessing 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by