Finding Z-Transform of a piecewise function.

18 visualizaciones (últimos 30 días)
Astitva Ranjan
Astitva Ranjan el 20 de Sept. de 2024
Respondida: Paul el 20 de Sept. de 2024
I am trying to find the Z-transform of the piecewise function:
using the inbuilt function ztrans().
Here is the code I wrote:
syms n z
f = piecewise(n < 0, (1/2).^(-n), n >= 0, (1/3).^(n));
Z_f = ztrans(f);
disp(Z_f);
But the command window is giving the result:
>> untitled
ztrans(piecewise(n < 0, 1/(1/2)^n, 0 <= n, (1/3)^n), n, z)
I dont know what I am doing wrong. Is there another way to do this?

Respuesta aceptada

Arnav
Arnav el 20 de Sept. de 2024
Editada: Arnav el 20 de Sept. de 2024
I understand that you are trying to find the Z-Transform of a piecewise function and are not getting a simplified explicit value of the result.
You can rewrite the piecewise function using heaviside function as:
syms n z
f = (1/2).^(-n) * heaviside(-n) + (1/3).^(n) * heaviside(n); % Define the piecewise function
Z_f = ztrans(f, n, z); % Compute the Z-transform
Z_f
You may refer to the documentation of heaviside function to learn more:
Hope it helps.

Más respuestas (1)

Paul
Paul el 20 de Sept. de 2024
Based on the context of the question, it is quite likely that the problem is to solve for the bilateral z-transform of f(n). However, ztrans finds the unilateral z-transform.
To solve this problem in Matlab one has to define the f(n) as the sum of a causal signal and a non-causal signal. The z-transform of each can be found using ztrans and application of z-transform properties. Those results can be summed to find F(z) as long as their regions of convergence overlap.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by