cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Plot two transfer function in one plot

Mirui
6-Contributor

Plot two transfer function in one plot

Hi,

I am having few issue with plotting transfer function:

  1. Bode plot
    1. How to make line more obvious in the low frequency area?
    2. How to get ride of #4 zone of the plot, it doesn't have any
  2. I cannot plot phase plot, and i don't know why, please.

2023-05-24 220326.jpg

Attached is what i have done.

1 ACCEPTED SOLUTION

Accepted Solutions
Werner_E
24-Ruby V
(To:Mirui)

You forgot to vectorize the function calls at the y-axis!!

Werner_E_0-1685038265006.png

Werner_E_1-1685038274654.png

 

View solution in original post

9 REPLIES 9
Fred_Kohlhepp
23-Emerald I
(To:Mirui)

The "error message" under the phase plot provides a potential clue!  Try " Re(H(w*1j)) "

Werner_E
24-Ruby V
(To:Mirui)

omega is a range, not a vector and so you get into troubles when you use omega as argument in your function H.

H(omega*1j)= will display what looks like a vector (but isn't) and trying to assign it a variable like X:=H(omega*1j) would throw an error.

One way to deal with the problem would be to turn omega into a vector.

But I was surprised to see that just applying vectorization does the job as well:

Werner_E_0-1685019524274.png

Vectorization (the arrow over the expression) can be applied via its keyboard short or via the menu

Werner_E_1-1685019771217.png

 

EDIT: Actually it is a strange error as IMHO it SHOULD work the way you had tried to do.

EDIT2: Actually it indeed does work the way you had set it up.  As I noticed later (see my answer below) simply recalculating the sheet makes the error vanish.

Mirui
6-Contributor
(To:Werner_E)

This morning i copied a phase plot from other documents and it starts to work! this is wield!

Werner_E
24-Ruby V
(To:Mirui)

Strange, yes.

I just gave it a try, opened your original sheet (which shows the error) in Prime 9 and simply, without changing anything, let it recalculate - the plot showed up without any error.

 

But using log spaced values for omega and vectorization as shown is the better approach anyway.

Werner_E
24-Ruby V
(To:Mirui)

According the visibility of the traces in your first plot:

Prime only plots tiny points without connecting them if the trace consists of 50000 or more points which is the case in your plot. The settings for Symbol, Line Style and Trace Thickness are ignored, only the color can be changed. Using your range variable each trace consists of 200001 points.

One way to deal with is to decrease the number of points to be plotted by using a larger step in the range

Werner_E_3-1685025912850.png

 

But as you have a logarithmically scaled abscissa, it would be a better idea to evenly space the omega values at the log x-axis. This can't be done using a range variable, but this is exactly what the functions "logpts()" and "logspace()" are made for.
As they create a vector and not a range, you should use vectorization when you use omega as function argument.

Here just 1000 points are used for plotting each trace:

Werner_E_4-1685026482806.png

Using a vector for omega and using vectorization when you use it also cures the problem with the "arg" function.

 

Prime 9 file attached

 

Mirui
6-Contributor
(To:Werner_E)

Thanks, the 1,22,...10^6 trick worked! But last method didn't, on my side it didn't give me any error, but there is no line anymore in graph area.

Werner_E
24-Ruby V
(To:Mirui)

You will have to post the sheet so we could see what did not work and why.

Did you experience that "empty" plot right after opening my sheet?

 

Using logspace definitely is the better approach as (even though it works) its not a good idea to set up about half a million points for each trace to compute.

Mirui
6-Contributor
(To:Werner_E)

Here is my sheet.

Werner_E
24-Ruby V
(To:Mirui)

You forgot to vectorize the function calls at the y-axis!!

Werner_E_0-1685038265006.png

Werner_E_1-1685038274654.png

 

Top Tags