Forums

Modeling Issues (difference equation to Laplace)

Started by Modeling August 15, 2014
First off, Hello all.  I am new here.  I have been working on a project for
some time and have came to a point where I am stuck.  I have researched
some technical papers and can not figure out how someone came from point a
in the paper (a difference equation) to point b ( a transfer function in
the s domain).  If anyone can shed light on the matter it would be greatly
appreciated.  The equations are as follows:

Difference:  P(k) = A1*P(k-1) +B0*V(k)+B1*V(k-1)

Transfer Function :  P(s) = (s*B0 + B1)/(s+A1)

I initially did a z-transform on the difference equations and got:

P[z] = (z*B0 + B1)/(z - A1)

I believe I may not have the best grasp on the understanding of the
relationship between the difference equation, transfer function,
z-transform and laplace.  I am under the impression that from the
z-transform on the difference equation, to get the s-domain you needed to
use z=(2+sT)/(2-sT) or z= e^sT.  



	 

_____________________________		
Posted through www.DSPRelated.com
On Fri, 15 Aug 2014 14:55:49 -0500, Modeling wrote:

> First off, Hello all. I am new here. I have been working on a project > for some time and have came to a point where I am stuck. I have > researched some technical papers and can not figure out how someone came > from point a in the paper (a difference equation) to point b ( a > transfer function in the s domain). If anyone can shed light on the > matter it would be greatly appreciated. The equations are as follows: > > Difference: P(k) = A1*P(k-1) +B0*V(k)+B1*V(k-1) > > Transfer Function : P(s) = (s*B0 + B1)/(s+A1) > > I initially did a z-transform on the difference equations and got: > > P[z] = (z*B0 + B1)/(z - A1) > > I believe I may not have the best grasp on the understanding of the > relationship between the difference equation, transfer function, > z-transform and laplace. I am under the impression that from the > z-transform on the difference equation, to get the s-domain you needed > to use z=(2+sT)/(2-sT) or z= e^sT.
I would look at the paper again, carefully. If they really carried the A1, B0 and B1 over from the difference equation into the Laplace-domain transfer function, then they're nothing more or less than entirely wrong. Your z-domain transfer function is correct. The relationship between the difference equation and it's z-domain transfer function is fairly simple and direct. There is no exact way to go from a z-domain transfer function to a Laplace domain one. This is because the Laplace domain describes the behavior of linear, time-invariant systems, and a system with sampling may be linear, but it's not time-invariant. You can, under certain circumstances, start with a z-domain transfer function and some information about sampling rates, sampling methods, and reconstruction methods, and APPROXIMATE a Laplace-domain transfer function -- but it won't be exact, and it won't be nice and tidy. So the bottom line is, if you aren't mis-reading the paper, if whoever wrote it still has his head in the same place he should be careful about exhaling -- it'll give him gas pains. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
>> There is no exact way to go from a z-domain transfer function to a
Laplace domain one. Hi, I agree with that in a sense that I can't turn a s-domain filter directly into a discrete-time equivalent without some approximations (i.e. predistorted bilinear transform). But: No one stops me from evaluating a discrete-time transfer function in continuous time and vice versa. Simply use s=i omega or z = exp(-2 pi i f/fs). It looks to me like this was done in the paper. It's a standard problem - I want a combined analog-digital frequency response. I use this all the time for radio transceiver paths. A physical justification is that I can separate sampling and unit delay, and construct an equivalent filter from "analog" delay lines (i.e. acoustic waves in a FIR filter). It will be indistinguishable from the sampled version, except that there is no aliasing relative to the unit delay. _____________________________ Posted through www.DSPRelated.com
>> i.e. acoustic waves in a _SAW_ filter
_____________________________ Posted through www.DSPRelated.com
I have used Matlab to do the conversion from z to Laplace domain, I tried
ZOH, FOH, and biliniear(tustin) method to do so.  ZOH and FOH both increase
the order by 1 to allow negative real poles, while bilinear blows my
coefficient which should be around +- 1.5 to around 96.  None of them give
the desired results, while just using the laplace equation from original
post and directly plugging in the coefficient values from my non linear
least squares does for 1st order, but requires sign adjustments for 2nd
order.  Mathematically, I have not been able to find an explanation and I
am not going to go through all possible sign combinations for third order.


Anythoughts?

>>> There is no exact way to go from a z-domain transfer function to a >Laplace domain one. > >Hi, > >I agree with that in a sense that I can't turn a s-domain filter directly >into a discrete-time equivalent without some approximations (i.e. >predistorted bilinear transform). > >But: No one stops me from evaluating a discrete-time transfer function in >continuous time and vice versa. Simply use s=i omega or z = exp(-2 pi i >f/fs). >It looks to me like this was done in the paper. It's a standard problem -
I
>want a combined analog-digital frequency response. I use this all the
time
>for radio transceiver paths. > >A physical justification is that I can separate sampling and unit delay, >and construct an equivalent filter from "analog" delay lines (i.e.
acoustic
>waves in a FIR filter). It will be indistinguishable from the sampled >version, except that there is no aliasing relative to the unit delay. > >_____________________________ >Posted through www.DSPRelated.com >
_____________________________ Posted through www.DSPRelated.com
On Tue, 09 Sep 2014 12:21:43 -0500, Modeling wrote:

(top posting fixed)

>>>> There is no exact way to go from a z-domain transfer function to a >>Laplace domain one. >> >>Hi, >> >>I agree with that in a sense that I can't turn a s-domain filter >>directly into a discrete-time equivalent without some approximations >>(i.e. predistorted bilinear transform). >> >>But: No one stops me from evaluating a discrete-time transfer function >>in continuous time and vice versa. Simply use s=i omega or z = exp(-2 pi >>i f/fs). >>It looks to me like this was done in the paper. It's a standard problem >>- > I >>want a combined analog-digital frequency response. I use this all the > time >>for radio transceiver paths. >> >>A physical justification is that I can separate sampling and unit delay, >>and construct an equivalent filter from "analog" delay lines (i.e. > acoustic >>waves in a FIR filter). It will be indistinguishable from the sampled >>version, except that there is no aliasing relative to the unit delay.
> I have used Matlab to do the conversion from z to Laplace domain, I > tried ZOH, FOH, and biliniear(tustin) method to do so. ZOH and FOH both > increase the order by 1 to allow negative real poles, while bilinear > blows my coefficient which should be around +- 1.5 to around 96. None > of them give the desired results, while just using the laplace equation > from original post and directly plugging in the coefficient values from > my non linear least squares does for 1st order, but requires sign > adjustments for 2nd order. Mathematically, I have not been able to find > an explanation and I am not going to go through all possible sign > combinations for third order. > > > Anythoughts?
What Mark (I think mnentwig = Mark) is talking about is that you can apply the z transform to analog circuits that have a bunch of equal delays, as, for example, with SAW filters or lengths of coaxial cable. However, he did NOT say that you can do what you're setting out to do. My thoughts? Either you have a paper that contains errors, or you are not applying what is in the paper correctly. If you have a linear, step-invariant system that is working in sampled time then a z domain transfer function can model it exactly. If you have a linear, time-invariant system that is working in continuous time, then (with qualifiers for really oddball systems), then a Laplace-domain transfer function can model it exactly. If you want to exactly model a sample-time system with a Laplace-domain transfer function -- well, tough luck, that can't be done. The Laplace domain can be used for analyzing TIME INVARIANT systems, and a sampled- time system is time varying. If you have a z-domain model of some system that contains a sampler, and you want to get a model of some part of it that is continuous time, then you MIGHT be able to do so, with some constraints on that continuous-time part. But this is not something that has a grand general solution -- it's just a solution for one specific family of cases. So instead of worrying about what you can't do, why don't you tell us what you have and what you want to achieve, and we'll try to suggest means to get there. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
Okay, so to clarify what i am trying to do, I have sampled data at 60 hz
over 1 minute.  The data contains a system disturbance at which i am trying
to model the response to.   I am using the difference equation to get a
transfer function for real and reactive power as a function of voltage and
frequency.  The data is compared to the original and error calculated. 
Using the method described above, I have the first order and second order
working,  but the signs on the coefficient have to be hand adjusted through
trial and error at this point. as you can imagine, doing this for 3rd order
becomes very tedious as I actually have numerous sets of data and each one
appears to take a different arrangement of signs.  I can not explain why
this is, which is why i went through all the Z to laplace conversions in
MATALB, but they dont work at all or are much worse then the original
model.  

>On Tue, 09 Sep 2014 12:21:43 -0500, Modeling wrote: > >(top posting fixed) > >>>>> There is no exact way to go from a z-domain transfer function to a >>>Laplace domain one. >>> >>>Hi, >>> >>>I agree with that in a sense that I can't turn a s-domain filter >>>directly into a discrete-time equivalent without some approximations >>>(i.e. predistorted bilinear transform). >>> >>>But: No one stops me from evaluating a discrete-time transfer function >>>in continuous time and vice versa. Simply use s=i omega or z = exp(-2
pi
>>>i f/fs). >>>It looks to me like this was done in the paper. It's a standard problem >>>- >> I >>>want a combined analog-digital frequency response. I use this all the >> time >>>for radio transceiver paths. >>> >>>A physical justification is that I can separate sampling and unit
delay,
>>>and construct an equivalent filter from "analog" delay lines (i.e. >> acoustic >>>waves in a FIR filter). It will be indistinguishable from the sampled >>>version, except that there is no aliasing relative to the unit delay. > >> I have used Matlab to do the conversion from z to Laplace domain, I >> tried ZOH, FOH, and biliniear(tustin) method to do so. ZOH and FOH
both
>> increase the order by 1 to allow negative real poles, while bilinear >> blows my coefficient which should be around +- 1.5 to around 96. None >> of them give the desired results, while just using the laplace equation >> from original post and directly plugging in the coefficient values from >> my non linear least squares does for 1st order, but requires sign >> adjustments for 2nd order. Mathematically, I have not been able to
find
>> an explanation and I am not going to go through all possible sign >> combinations for third order. >> >> >> Anythoughts? > >What Mark (I think mnentwig = Mark) is talking about is that you can apply
>the z transform to analog circuits that have a bunch of equal delays, as,
>for example, with SAW filters or lengths of coaxial cable. > >However, he did NOT say that you can do what you're setting out to do. > >My thoughts? Either you have a paper that contains errors, or you are not
>applying what is in the paper correctly. > >If you have a linear, step-invariant system that is working in sampled >time then a z domain transfer function can model it exactly. If you have
>a linear, time-invariant system that is working in continuous time, then >(with qualifiers for really oddball systems), then a Laplace-domain >transfer function can model it exactly. > >If you want to exactly model a sample-time system with a Laplace-domain >transfer function -- well, tough luck, that can't be done. The Laplace >domain can be used for analyzing TIME INVARIANT systems, and a sampled- >time system is time varying. > >If you have a z-domain model of some system that contains a sampler, and >you want to get a model of some part of it that is continuous time, then >you MIGHT be able to do so, with some constraints on that continuous-time
>part. But this is not something that has a grand general solution -- it's
>just a solution for one specific family of cases. > >So instead of worrying about what you can't do, why don't you tell us what
>you have and what you want to achieve, and we'll try to suggest means to >get there. > >-- > >Tim Wescott >Wescott Design Services >http://www.wescottdesign.com >
_____________________________ Posted through www.DSPRelated.com
Tim Wescott <seemywebsite@myfooter.really> wrote:
 
> (top posting fixed)
(preiously snipped, someone wrote) (snip)
> What Mark (I think mnentwig = Mark) is talking about is that you can apply > the z transform to analog circuits that have a bunch of equal delays, as, > for example, with SAW filters or lengths of coaxial cable.
> However, he did NOT say that you can do what you're setting out to do.
> My thoughts? Either you have a paper that contains errors, or you are not > applying what is in the paper correctly.
> If you have a linear, step-invariant system that is working in sampled > time then a z domain transfer function can model it exactly. If you have > a linear, time-invariant system that is working in continuous time, then > (with qualifiers for really oddball systems), then a Laplace-domain > transfer function can model it exactly.
Without claiming to understand the above, this reminds me of a certain type of differential equation popular in nuclear physics, among others. The differential equations we are all used to, and in some special cases (constant coefficients, for one) know how to solve relate values of a function and its derivatives, all at the same time. There is another type that relates a function value and its derivatives to values at previous times. You might have f'(t)=A f(t)-B f(t-1) for example. Among the fun solutions to some of these equations is Xenon poisoning in nuclear reactors, the cause of the Chernobyl explosion. (There might be terms that depend on values hours or days before.) It seems that some of the early reactors were built before xenon poisoning was known, but forturnately over-engineered (built with more uranium than one might have thought) enough that they could still run. -- glen