# Analytic Signal Block in Simulink Gives Reduced Amplitude for the Imaginary Part

In Simulink, I have connected a sine wave to zero-order hold and zero-order hold to analytic signal block, as in the figure below. My purpose is to transform the real signal to the corresponding analytic signal by adding complex part, in order to be able to do some phase shifting operations. Zero-order hold block is to discretize the signal, as the analytic signal accepts only discrete signals. Now, the problem is this: when I discretize the signal "more finely" by setting the sample time of zero-order hold to a smaller number (eg. $$0.00003$$), imaginary part of the analytic signal output is reduced significantly, while the real part staying normally, as seen in the figure below. On the contrary, when the sample time is set to a greater number (eg. $$0.0003$$) amplitudes of the real and the imaginary parts of the analytic signal output are the same, as expected. According to the Matlab's documentation, analytic signal block's output is like this: $$y=u+j H \{\ u \}\$$, where $$H \{\ \}\$$ denotes the Hilbert transform and $$j$$ = $$\sqrt{-1}$$. So, in the setup mentioned above it seems like when the continuous signal is sampled wıth a higher frequency, Hilbert transform reduces the amplitude.

Why would Hilbert transform reduce the amplitude, or is there a problem with my setup in Simulink?

If the filter has a fixed order then increasing the sampling rate will make its response scale with frequency, thus the transition width increases relative to the sampling frequency. For example: if $$f_s=1\;\mathrm{kHz}$$ and $$\omega_{tw}=10\;\mathrm{Hz}$$ for a given order then keeping the order and increasing $$f_s$$ tenfold will make $$\omega_{tw}$$ increase tenfold.

I don't have Matlab but according to the documentation you linked the block perfoms a Hilbert transform using a FIR (which makes sense). Since I also don't have your other details, I'm testing this with a Kaiser window and the Kaiser order formula, using $$A_s=-40\;\mathrm{dB}$$ and $$\omega_{tw}=1\;\mathrm{Hz}$$. When $$f_s=10\;\mathrm{Hz}$$ the order is $$23$$ (length $$24$$). Using a $$1\;\mathrm{Hz}$$ signal at the input results in an analytic signal at the output equal in amplitude with the input. Here is the result in LTspice (note: the input V(x) is not delayed, so the two signals are not in quadrature): Keeping the order and increasing $$f_s=100\;\mathrm{Hz}$$ results in $$\omega_{tw}=10\;\mathrm{Hz}$$, and for the same $$1\;\mathrm{Hz}$$ input the output is reduced: In order to avoid this the order needs to be increased. In this case it ends up being $$224$$ (length $$225$$): If you compare the 1st and the 3rd pictures you'll see the similarities in the delays, unlike the 2nd picture, and that makes sense since the phase is fixed so the outcome needs to end up delayed by the same amount if you change the sampling frequency. I haven't posted any frequency domain responses, but you should be able to see for yourself, easily.

• With this amplitude difference between the real and imaginary parts of the signal, is it possible to get a correct result from phase shift operation, (I am concerned only with the real part after the phase shift)? Aug 30, 2021 at 6:39
• Is it possible to compensate this amplitude difference with a gain? In order to avoid making the system slower by increasing the filter order. Aug 30, 2021 at 6:39
• How can I calculate the necessary filter order? Aug 30, 2021 at 6:44
• @trxrg I have asked around people who have access to Matlab and they told me that the block is composed of a FIR and a delay of half the filter's order, in parallel, with the delay giving the real part and the FIR the imaginary. So any difference is only due to the filter, and its order needs to be calculated according to the algorithm that is used. Here the FIR uses a Kaiser window so the order is calculated with Kaiser's formula:$$N=\dfrac{A_s-7.95}{2.285\omega_{tw}}$$This is not a universal formula, but all of them revolve around $\omega_{tw}$ (and, maybe $A_s$). Aug 30, 2021 at 15:06
• If the order cannot be calculated to give unity magnitude at the desired frequency, or if the order is fixed, then the only way to compensate is with a gain: either amplify the imaginary part or attenuate the real part. Or account for the magnitude difference when calculating the phase shift, same thing. The gain can be calculated by evaluating the transfer function at that frequency, $H(j\Omega_f)$. You will lose some numeric precision, but as long as the signal doesn't need to be amplified by tens or hundreds or more, you should be fine. Aug 30, 2021 at 16:59