0
$\begingroup$

I have a system and I know its impulse response $h$, this impulse response was recorded at $f_s = 48000 \texttt{Hz}$, now I can use Matlab to get the system output to an arbitrary signal ($x$) by convolving it with $h$, right?

So now I want to use an input signal that its at a higher frequency [$3.072 \texttt{MHz}$ (factor $64$)] but want to use the same IR, I was hopping to just upsample the IR, either by zero padding or by interpolating the $63$ spaces between coefficients, but the output was not matching, using Matlab I got the frequency response of the Impulse response, in blue the original sampled at $48 \texttt{KHz}$, the red one is the upsampled one, yellow the interpolated.

frequency response

They kind of match, but there are several gaps in the plot, is this even doable? This is my Matlab code (top_ir is the impulse response of the system):

[h, w] = freqz(top_ir,1,[],48000);
plot(w,20*log10(abs(h)));
top_ir_3m = upsample(top_ir, 64);
[h, w] = freqz(top_ir_3m,1,[],48000*64);
plot(w,20*log10(abs(h)));
top_ir_3m = interp(top_ir, 64);
[h, w] = freqz(top_ir_3m,1,[],48000*64);
plot(w,20*log10(abs(h)));

EDIT (adding info): I understand that the original IR only contains information up to 24kHz, that is fine, we are actually going to lowpass filter everything up to 24kHz.

$\endgroup$
3
  • 1
    $\begingroup$ We need slightly more information: Do you want to use this impulse response with the same absolute frequency characteristics? that is, I see max gain is at about $8 \texttt{Khz}$ . Do you want max gain to be at $8\texttt{Khz}$ in your "new" impulse response as well? Or do you want it at $8\cdot 64=512\texttt{Khz}$ ? In the first case interpolating is fine. In the second, you can just apply your filter as is... $\endgroup$
    – Jdip
    Commented Aug 30, 2023 at 8:24
  • 1
    $\begingroup$ @JdipL correct. Brain freeze on my part, too early in the morning :-) $\endgroup$
    – Hilmar
    Commented Aug 30, 2023 at 8:40
  • $\begingroup$ MATLAB has a resample() function that you can use to interpolate between samples of your original impulse response. $\endgroup$ Commented Aug 30, 2023 at 17:39

2 Answers 2

1
$\begingroup$

NOTE: Your terminology and information provided is somewhat confusing. An impulse response is a time signal. What you plotted seems to be some kind of spectrum. I'm not familiar with matlab, but a quick look in the documentation of freqz leaves me wondering, what your code actually does. The plot does as well.

Anyway, if you recorded your impulse response with a 48kHz sampling frequency, it does not contain any information regarding the system's behaviour above 24kHz. There is no way to garner this information by interpolating/upsampling. While algorithms for bandwidth expansion do exist, a factor of 64 seems to be a very long shot in any case.

$\endgroup$
3
  • $\begingroup$ Sorry, everywhere I have seen it is called a discrete time impulse response, I omitted the discrete time since we are talking about dsp. as for the second point, yea I understand and actually we are going to low pass everything after 24 kHz, but the input signal is coming in PDM with OSR 64 so we are trying to natively use that sample rate $\endgroup$ Commented Aug 30, 2023 at 17:32
  • $\begingroup$ But you're plotting this function of time on a plot labeled "Hz". That does not make sense. $\endgroup$ Commented Aug 30, 2023 at 17:37
  • $\begingroup$ @robertbristow-johnson it is indeed a magnitude response that is plotted, not the impulse response. $\endgroup$
    – Jdip
    Commented Aug 30, 2023 at 19:23
0
$\begingroup$

After some testing I found out that Matlab caps the frequency response result, changing the taps for the freqz to the length of the coefficients give the actual result, upsampling does generate a usable impulse response, to use an interpolated impulse response, you just need to divide the coefficients by the oversample rate

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.