Finding Z-Transform of a piecewise function.
7 ビュー (過去 30 日間)
古いコメントを表示
I am trying to find the Z-transform of the piecewise function:![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1776385/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1776385/image.png)
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?
0 件のコメント
採用された回答
Arnav
2024 年 9 月 20 日
編集済み: Arnav
2024 年 9 月 20 日
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.
その他の回答 (1 件)
Paul
2024 年 9 月 20 日
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.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Calculus についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!