Finding Z-Transform of a piecewise function.
Show older comments
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?
Accepted Answer
More Answers (1)
Paul
on 20 Sep 2024
0 votes
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.
Categories
Find more on z-transforms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!