So I'm working on a problem and I'm not exactly sure what the following question is asking:
Write a C function that implements the following Z transform
y(z) = G(z) = az2 + bz + c
u(z) .......... z2 + dz + e
Where the sample time is 0.02 seconds and
a = 0
b = 0.1218
c = 0.09338
d = -1.2382
e = 0.4531
The function accepts u as an input argument and returns y
note - the ....'s above are just for spacing
what has me stumped is how to re-arrange the transform so that u is an input and y is the output.
edit: I do have MatLab7 to use in figuring this out.
PRFYNAFBTFCP
Captain of the MFS Frigate of Pizazz +2 vs. Douchebags - Est vicis pro nonnullus suscito vir
"Are you an idiot? What demand do you think there is for aircraft carriers that aren't government?" - Captain Chewbacca
"I keep my eighteen wives in wonderfully appointed villas by bringing the underwear of god to the heathens. They will come to know God through well protected goodies." - Gandalf
"There is no such thing as being too righteous to understand." - Darth Wong
Quick questions:
The under-bar below the y(z) expression does that mean y(z)/u(z) = quadratic top/ quadratic bottom ?
Or, is it y(z) = az^2 + bz + c and u(z) = z^2 + dz + e ?
Also if a = 0 then does this mean y(z) = bz + c
Also, the Z - transform I've heard of is a type of Laplace transform, is the z here complex or real?
Bottlestein wrote:Quick questions:
The under-bar below the y(z) expression does that mean y(z)/u(z) = quadratic top/ quadratic bottom ?
yes. G(z) = y(z)/u(z) and G(z) IS a Z-Transform.
Also if a = 0 then does this mean y(z) = bz + c
yes
Also, the Z - transform I've heard of is a type of Laplace transform, is the z here complex or real?
The Z-Transform is a discrete case of the Laplace, used for digital signals. I'm not sure what you mean by "the z" being real or complex. Solving G(z) by partial fractions gives real roots, but doesn't put me any closer to having y(z) as a function of u(z). I believe I need to invert the transform but I don't know how.
PRFYNAFBTFCP
Captain of the MFS Frigate of Pizazz +2 vs. Douchebags - Est vicis pro nonnullus suscito vir
"Are you an idiot? What demand do you think there is for aircraft carriers that aren't government?" - Captain Chewbacca
"I keep my eighteen wives in wonderfully appointed villas by bringing the underwear of god to the heathens. They will come to know God through well protected goodies." - Gandalf
"There is no such thing as being too righteous to understand." - Darth Wong
I've never worked with Z-transforms before (read: no discrete math training whatever), but checking Wiki, if you want to invert the transform, you need to do a contour integral similar to the Bromwich integral for Laplace transforms. I'll try and give this problem a shot over the next couple of days, but I don't know how much help I'll be.
Kodiak wrote:I'm not sure what you mean by "the z" being real or complex.
He's asking if z can have an imaginary part or not - i.e., can it have the form a+ib (or reiθ), or must b = 0?
Bottlestein wrote:I'll try to figure this out as well...
I'll assume z is complex
When did you need a solution by Kodiak?
Today if possible, or tomorrow at the latest. I'm working on it today and will try some of what's been posted here. The rest of the work involves control diagrams and logic flow as well as dissecting an existing program to show how it works. All-in-all I've put in about 15 hours on this "exercise" and I appreciate the help. For a while there I was afraid I'd reached the peak of SDN's math ability.
PRFYNAFBTFCP
Captain of the MFS Frigate of Pizazz +2 vs. Douchebags - Est vicis pro nonnullus suscito vir
"Are you an idiot? What demand do you think there is for aircraft carriers that aren't government?" - Captain Chewbacca
"I keep my eighteen wives in wonderfully appointed villas by bringing the underwear of god to the heathens. They will come to know God through well protected goodies." - Gandalf
"There is no such thing as being too righteous to understand." - Darth Wong
Pardon me if I'm being stupid, but can't you just multiply G by u and output the product to y? The math looks like trivial algebra. Presumably there is a good algebra library somewhere that you can use to do everything, read u as a string of text, convert it into some variety of algebra array or something, take u_algebra and G_algebra as arguments, multiply them, and output y.
That's initially what I thought to do too, Feil, but he might want G(z) itself as a function of u(z) (I think that's what the problem wants, anyway). How to do that, I'm not sure.
PS: If you want to solve this with y=y(z)=y(u(z))=u(z)G(z), make sure you discard the u=0 case to avoid fallacious results from the initial divide-by-zero.
Feil wrote:PS: If you want to solve this with y=y(z)=y(u(z))=u(z)G(z), make sure you discard the u=0 case to avoid fallacious results from the initial divide-by-zero.
It seems to me here that G(z) is the Z Transform of Y(z)/u(z). I need to wind up with a function of y(u) which will necessitate an Inverse Transform of G(z). I've got a good grasp here and am going forward (even a well executed wrong solution is better than "I couldn't come up with anything") but feel free to post insights.
PRFYNAFBTFCP
Captain of the MFS Frigate of Pizazz +2 vs. Douchebags - Est vicis pro nonnullus suscito vir
"Are you an idiot? What demand do you think there is for aircraft carriers that aren't government?" - Captain Chewbacca
"I keep my eighteen wives in wonderfully appointed villas by bringing the underwear of god to the heathens. They will come to know God through well protected goodies." - Gandalf
"There is no such thing as being too righteous to understand." - Darth Wong
And now we can look up the appropriate inverse transform from the table, like so:
See post below.]
Toss in the constants if you want and that should be it. I'm just kinda wondering why sample rate is mentioned in the problem at all, I don't see how it's relevant.
Broke your links for you.
"Death before dishonour" they say, but how much dishonour are we talking about exactly? I mean, I can handle a lot. I could fellate a smurf if the alternative was death.
- Dylan Moran
Ghetto edit: It occurred to me (too late as usual) that you might not want the entire solution just like that. So I broke the original image links, and will repost my solution here behind spoiler tags.
As a tip, just look at the first two lines of the z-transform table I posted previously. You should be able to fiddle the original equation to a form where you can obtain the inverse transform from the first two lines of the table. Spoiler
And now we can look up the appropriate inverse transform from the table, like so:
"Death before dishonour" they say, but how much dishonour are we talking about exactly? I mean, I can handle a lot. I could fellate a smurf if the alternative was death.
- Dylan Moran