0
\$\begingroup\$

From an electrical circuit, I have the transfer function as: $$ H(s) = \frac{R}{sRC + 1} $$ \$V\$ is the output and I is the input so we can write: $$ V(s) = I(s) H(s) $$ or $$ V(jω) = I(jω) H(jω) $$ Now I have the output \$V(t)\$ as array of sampled voltages. As I have written above, I also know the transfer function.

In this case, how can I obtain the input \$I(t)\$ as array of samples? I am using Python.

\$\endgroup\$
4
  • \$\begingroup\$ You're talking about sampled signals, but you're showing a continuous time transfer function (in frequency domain). If what you have is a sampled output, convert your Laplace t.f. into its discrete equivalent, find out the impulse response, then use deconvolution. There are some more posts on dsp.ee about this. \$\endgroup\$ Commented Oct 21, 2021 at 14:55
  • \$\begingroup\$ Please do not create multiple threads asking the same questions - electronics.stackexchange.com/questions/591563/… \$\endgroup\$
    – Carl
    Commented Oct 21, 2021 at 16:20
  • \$\begingroup\$ @Carl Forgot to delete that was unclear. \$\endgroup\$
    – GNZ
    Commented Oct 21, 2021 at 16:39
  • \$\begingroup\$ @aconcernedcitizen Thanks for the tip. Its because I only have the tf in freq domain not in discrete time domain h(n) I dont know how to convert H(s) to h(n) yet \$\endgroup\$
    – GNZ
    Commented Oct 21, 2021 at 16:41

1 Answer 1

1
\$\begingroup\$

Now I have the output \$v(t)\$ as array of sampled voltages.

It seems like you are missing a fundamental concept about signal processing. An array is not a function of time. A function \$V(t)\$ is dependent on time, but when you have an array of numbers in a software program, time is completely irrelevant. They are just values stored in memory. When you access the values in the array, they become a function of the index. You can call these values samples, and say they are dependent on the sample index n. This means what you really have is \$v[n]\$ where there are n samples, and \$v[n]\$ is the value of the nth sample.

Now how you obtain the samples is a different story. If \$v[n]\$ is a discrete voltage signal, you likely used some method to measure the voltage of a continuous voltage signal \$V(t)\$ every T seconds, and recorded those values. Remember the recorded values are not a function of time, but a function of index. Once the values are recorded, all you have is a list of numbers with no reference to time whatsoever. You can make those values meaningful with respect to time if you remember the sampling interval T. Then you can make the following idealized association: \$v[n] = V(nT)\$. Practically however there is likely some measurement error that makes the above association only almost true.

how can I obtain the input I(t) as array of samples?

Here is one approach:

  1. Convert your transfer function \$H(s)\$ into the equivalent discrete-time system \$H(z)\$. There are many ways to map the s-domain into the z-domain. Some ways are more accurate than others. A pretty standard approach is to use the bilinear transform: $$s = \frac{2}{T}\frac{1-z^{-1}}{1+z^{-1}}$$

  2. Find the frequency response of \$H(z)\$ (\$H(z) = H(j\omega_d)\$ where \$\omega_d\$ is the discrete-time frequency of the signal). Typically, you can calculate \$\omega_d\$ as \$\omega_d = \omega T\$, but the bilinear transform causes non-linear frequency warping, so you need to use the following formula instead: $$\omega_d = \frac{2}{T} arctan(\frac{\omega T}{2})$$ When you use this in Python, you will need to represent \$\omega_d\$ with a finite array which makes it a discrete function \$H[k]\$.

  3. Take the DFT of \$v[n]\$ to get \$V[k]\$ which is a discrete representation of the DTFT of \$v[n]\$ (which is \$V(j\omega_d)\$). In Python all you need to do is numpy.fft.fft(v) where v is your array of voltages.

  4. Use the deconvolution theorem to calculate \$I[k]\$. You mentioned in the question that you know $$V(j\omega) = I(j\omega) H(j\omega)$$ This means you can simply rearrange so (for the discrete case) $$I[k] = \frac{V[k]}{H[k]}$$ Here's a stack overflow question/answer on how to do deconvolution in Python.

  5. Use the inverse DFT to calculate \$i[n]\$.

Now if you're just looking for the samples that correspond to \$I(t)\$ at every interval \$I(nT)\$, then you can stop there. If you really want to find \$I(t)\$ in continuous time, you will have to reconstruct it from \$i[n]\$.

\$\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.