How to compute transfer function

$$G(s) = \exp \left( - \sqrt{s} \right)$$

in Matlab / Simulink?

I am trying to calculate a PID controller for this function. This function describes heat transfer via conduction. I want so see first the step time response and impulse response for this system. I usually use for other functions the tf function from Matlab, including IODELAY, but in this case i can't compute $\sqrt{s})$.The error is:Undefined function 'sqrt' for input arguments of type 'tf'. Is there any other way to compute this transfer function?

enter image description here

Hi again, i just edited it because i found more information.In my case i guest that T=1.

enter image description here

For Figure 2.21 i have this:

enter image description here

  • 1
    $\begingroup$ i have never heard of such a transfer function. what is the input and output of this system? $\endgroup$ – robert bristow-johnson Jul 5 '20 at 17:23
  • $\begingroup$ Honestly i found some more info at the same author for this and is says :Temperature control is a very common application of PID control. Some models that are directly based on physics will now be discussed. Consider an infinitely long rod with thermal diffusivity 2. Assume that there is no radial heat transfer and that the input is the temperature at the left end of the rod. $\endgroup$ – Codrut Ceaureanu Jul 5 '20 at 17:30
  • $\begingroup$ i still don't know what the input and output of the system is. is it temperature? or some measure of heat flow? $\endgroup$ – robert bristow-johnson Jul 5 '20 at 17:44
  • $\begingroup$ I'm with @robertbristow-johnson here -- presumably the input and output here are temperatures, but we don't know that -- it could be that the input is heat flux or something, and the output is goodness-knows-what (certainly the fact that the ultimate gain is $e^=pi$ indicates that it's not temperature-in, temperature out, but if it's heat flux in, temperature out, then the problem lacks dimensions). $\endgroup$ – TimWescott Jul 5 '20 at 19:26
  • $\begingroup$ And $e^{-\sqrt s}$ suffers from every kind of dimensional problem just by itself. The argument to $\exp x$ must be dimensionless (or in Napirs if you want to be strict in your permissiveness, but Napirs insists on a ratio of like dimensions, so you're back to dimensionless). Please edit your question so that it is complete and sensible. $\endgroup$ – TimWescott Jul 5 '20 at 19:29

The inverse Laplace transform of $G(s)=e^{-\sqrt{s}}$ can be computed analytically:

$$g(t)=\mathcal{L}^{-1}\left\{e^{-\sqrt{s}}\right\}=\frac{1}{2t\sqrt{\pi t}}e^{-\frac{1}{4t}},\qquad t>0\tag{1}$$

[I've cross-checked this result by looking it up in one of my old math books.]

So now you have an analytical expression for the impulse response $g(t)$.

The step response can also be computed analytically. It is given by

$$s(t)=u(t)\int_0^t g(\tau)d\tau=\textrm{erfc}\left(\frac{1}{2\sqrt{t}}\right)u(t)\tag{2}$$

where $u(t)$ is the unit step function, and $\textrm{erfc}(\cdot)$ is the complementary error function. The result $(2)$ was obtained with a little help from WolframAlpha.

And that's how the impulse response and step response look like:

enter image description here

  • $\begingroup$ thank you! I just need to figure out now how to compute analytically those responses but i will search for it . Thank you again! $\endgroup$ – Codrut Ceaureanu Jul 5 '20 at 20:05

Matlab can only deal with transfer functions that are rational ratios of polynomials in $s$ (or $z$, if you're in that domain). So you must approximate. You can either use the responses that @Matt L. has shown you, and convolve by the impulse response at each step, or you can write the partial differential equation (not an ODE) and solve it at each time step, or you can approximate the transfer function as a rational fraction of polynomials in $s$.

For the rest of this answer I'm going to assume that you really mean $G\left ( s \right)$ is some lazy shorthand for a real-world dimensionally sensible form. If so, then you must really mean that $G \left (s \right ) = k e^{-\sqrt{\tau s}}$ where $k$ is in whatevers over whatever elses (what are your inputs and outputs?) and $\tau$ is in seconds so that $\tau s$ can be in Napirs.

I would do this by finding a ratio of polynomials in $s$ that approximates $e^{-\sqrt{\tau s}}$. Having dinged you for not using dimensions, I'd still probably start with $e^{-\sqrt{\theta}}$ and find an approximate polynomial in $\theta$ (use the letter that's most sensible to you), then scale it into a polynomial in $s$.

You want something that has a good-enough fit for you -- and this changes depending on the problem you want to solve. If you're designing a closed-loop controller, a good enough fit is probably one that doesn't deviate by more than five degrees or so in phase and 1dB or less in amplitude over the frequency range at which your closed-loop gain is higher than -10dB or so -- which means that depending on how aggressively you're designing your controller, you need more or less terms in your approximation.

You will, in essence, be designing a linear time invariant ODE that simulates the partial differential equation whose transfer function is $e^{-\sqrt{\tau s}}$.

Whatever else I did, I'd take the impulse and step response of my approximation and compare them to the ones that @Matt L. has shown you, and I'd make sure that they were close enough to be intuitively satisfying.

  • $\begingroup$ Thank you! i also posted some more info so that everyone can understand from where my tf came from. I think you and @Matt L. answered my question and i thank you so much! My teacher told me that this function is a bit tricky and not trivial but i couldn't find anything on point to what i have except your answers.Thank you! $\endgroup$ – Codrut Ceaureanu Jul 5 '20 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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