MATLAB Answers

How to plot magnitude and phase spectrum of the function

153 views (last 30 days)
Hye i really confuse on how much method to write the code to plot magnitude and phase. Below is my function.
X(z)=z / (z-1)^2
Any idea how to start beside plot?

  0 Comments

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 16 Jun 2020
Try this:
z = tf('z');
X = z / (z-1)^2;
bode(X)
.

  6 Comments

Show 3 older comments
Star Strider
Star Strider on 16 Jun 2020
As always, my pleasure!
That is the same result that I got.
MUHAMMAD RAHMAT ASMAT
MUHAMMAD RAHMAT ASMAT on 16 Jun 2020
Hye sorry to bother again, but i just raelize that after i amplify the signal and try to z transform it, it give me the ans, but i think it was not correct. Maybe my code is not accurate or vise versa.
>> d=decimate(p2,500);
>> amp=10*d;
>> syms amp %from here i think my z transform it not valid
>> f=amp;
>> ztrans(f)
ans =
z/(z - 1)^2
i need to calculate the spectrum of the decimated signal using Z-transform technique
Star Strider
Star Strider on 16 Jun 2020
I have no idea what you are doing, and I cannot run your code. I cannot imagine how you get a transfer function straight out of a decimated signal, or what ‘calculate the spectrum of the decimated signal using Z-transform technique’ refers to.
If you are estimating a transfer function from the input to and output of a discrete (sampled) system in either the time-domain or frequency-domain, you can either use the System Identification Toolbox functions (there are several that could apply), or the Signal Processing Toolbox invfreqz function. You will need to experiment with whatever functions you choose to use to get the result you want.
.

Sign in to comment.

More Answers (1)

Deepak Gupta
Deepak Gupta on 16 Jun 2020
Star Strider has given the answer but just FYI:
X = tf([1 0], [1 -2 1]);
bode(X), grid
This will work too.
You can know more about bode plots here:

  3 Comments

MUHAMMAD RAHMAT ASMAT
MUHAMMAD RAHMAT ASMAT on 16 Jun 2020
thank you for the info!
i try to write the code first any give a feedback later
Star Strider
Star Strider on 16 Jun 2020
Note that this creates a s-domain function, not a z-domain function.
Deepak Gupta
Deepak Gupta on 16 Jun 2020
It creates z-tranfer too. If we give sampling period 0.1s then you will get same result. i.e. tf([1 0], [1 -2 1], 0.1)

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!