Question: How to replace Y(z)/z^i terms in z-transfer function

Is it even possible to use a replacement list as attempted below to convert a z-transform to a finite difference expression?

z-transformed impulse response (`sampletime = 1/20`)

(10*exp(3/10)-7*exp(1/5)-3*exp(2/5))*exp(1/10)*U(z)/z+(exp(1/10)*(-3+10*exp(1/10)-7*exp(1/5))-(10*exp(3/10)-7*exp(1/5)-3*exp(2/5))*exp(1/10))*U(z)/z^2-(-3+10*exp(1/10)-7*exp(1/5))*exp(1/10)*U(z)/z^3 = 8*Y(z)*exp(1/10)*exp(3/10)*exp(1/5)+(8*((-exp(1/5)-exp(3/10))*exp(1/10)-exp(3/10)*exp(1/5)))*Y(z)/z+(8*(exp(1/10)+exp(1/5)+exp(3/10)))*Y(z)/z^2-8*Y(z)/z^3

(10*exp(3/10)-7*exp(1/5)-3*exp(2/5))*exp(1/10)*U(z)/z+(exp(1/10)*(-3+10*exp(1/10)-7*exp(1/5))-(10*exp(3/10)-7*exp(1/5)-3*exp(2/5))*exp(1/10))*U(z)/z^2-(-3+10*exp(1/10)-7*exp(1/5))*exp(1/10)*U(z)/z^3 = 8*Y(z)*exp(1/10)*exp(3/10)*exp(1/5)+8*((-exp(1/5)-exp(3/10))*exp(1/10)-exp(3/10)*exp(1/5))*Y(z)/z+8*(exp(1/10)+exp(1/5)+exp(3/10))*Y(z)/z^2-8*Y(z)/z^3

(1)

deg_mx := 3

3

(2)

Replacements to get finite difference equation

[seq(U(z)/z^i = U[q+1-i], i = deg_mx .. 0, -1), seq(Y(z)/z^i = Y[q+1-i], i = deg_mx .. 0, -1)]

[U(z)/z^3 = U[q-2], U(z)/z^2 = U[q-1], U(z)/z = U[q], U(z) = U[q+1], Y(z)/z^3 = Y[q-2], Y(z)/z^2 = Y[q-1], Y(z)/z = Y[q], Y(z) = Y[q+1]]

(3)

Attempt to replace

algsubs([U(z)/z^3 = U[q-2], U(z)/z^2 = U[q-1], U(z)/z = U[q], U(z) = U[q+1], Y(z)/z^3 = Y[q-2], Y(z)/z^2 = Y[q-1], Y(z)/z = Y[q], Y(z) = Y[q+1]][1], (10*exp(3/10)-7*exp(1/5)-3*exp(2/5))*exp(1/10)*U(z)/z+(exp(1/10)*(-3+10*exp(1/10)-7*exp(1/5))-(10*exp(3/10)-7*exp(1/5)-3*exp(2/5))*exp(1/10))*U(z)/z^2-(-3+10*exp(1/10)-7*exp(1/5))*exp(1/10)*U(z)/z^3 = 8*Y(z)*exp(1/10)*exp(3/10)*exp(1/5)+8*((-exp(1/5)-exp(3/10))*exp(1/10)-exp(3/10)*exp(1/5))*Y(z)/z+8*(exp(1/10)+exp(1/5)+exp(3/10))*Y(z)/z^2-8*Y(z)/z^3)

Error, (in algsubs) cannot compute degree of pattern in z

 

NULL

Download replace_Y_of_z_by_Y_of_q.mw

Please Wait...