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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

How to construct asymptotic bode plot in a more automatical way?

Cornel
19-Tanzanite

How to construct asymptotic bode plot in a more automatical way?

Hi,

How can I draw the ASYMPTOTIC bode plot of this function in more automatical way? Is it possible? I mean I know that this asymptotic bode plot can be draw after some manual analysis, but is it possible to make a program that can draw automatically this thing?

 

Cornel_1-1720175191607.png

I am expecting something like that (red plot):

Cornel_2-1720175219089.png

ACCEPTED SOLUTION

Accepted Solutions
LucMeekes
23-Emerald III
(To:Cornel)

So, after some fumbling I was able to improve the automatic asymptote generation for bode plots.

LucMeekes_0-1723498762802.png

The function should work fine for most real-world examples of filters,

as an example:

LucMeekes_1-1723498840000.png

or, another example:

LucMeekes_2-1723499032989.png

The option to supply H as a 2-column vector should work well if you import data from a circuit simulation program (Spice) to plot.

See attached file, which also works in Prime express. (Yes, all it took was a one-liner.)

 

Success!
Luc

View solution in original post

18 REPLIES 18
Werner_E
25-Diamond I
(To:Cornel)


@Cornel wrote:

Hi,

How can I draw the ASYMPTOTIC bode plot of this function in more automatical way? Is it possible? I mean I know that this asymptotic bode plot can be draw after some manual analysis, but is it possible to make a program that can draw automatically this thing?

Depending on those "some manual analysis" it may be possible to turn exactly those calculation into a program.

BTW, the third argument of the "logspace" function is dimensionless, its the number of entries created. I wonder why Prime does not throw an error when you chose 800 Hz as argument but rather seems to simply ignore the unit.

Cornel
19-Tanzanite
(To:Werner_E)

Werner_E
25-Diamond I
(To:Cornel)


@Cornel wrote:

I see that Matlab has some function that can do this:


So you should rather use Matlab instead of Mathcad for your tasks.

Matlab has a wealth of features and capabilities that Mathcad lacks.

 

Here is a bold attempt done with Mathcad. Sure not generic and not a 1-button-push solution.
You may use it as a starting point for your own attempts.

Werner_E_0-1720188334681.png

Prime 10 sheet attached

 

LucMeekes
23-Emerald III
(To:Cornel)

We've seen this before, like here: https://community.ptc.com/t5/Mathcad/Asymptotic-Bode-Plot-Issue-in-Mathcad-Prime-7/m-p/838849#M203772 

I've had another look at it and....How's this:

LucMeekes_0-1720301312424.png

Or, for another

LucMeekes_1-1720301356913.png

this:

LucMeekes_2-1720301399853.png

I should like to see the translation to Prime...

 

Success!
Luc

 

 

Cornel
19-Tanzanite
(To:LucMeekes)

Hm

Cornel_0-1720421454206.png

 

Or if we put like this, the error is this:

Cornel_0-1720421810894.png

ttokoro
20-Turquoise
(To:Cornel)

Just change logspace from function to variable, i. e. the program function Luc made. 

image.png

Cornel
19-Tanzanite
(To:ttokoro)

OK, now it works.

Cornel_0-1720428378992.png

@LucMeekes  Do you have any idea how to make also for the phase of bode plot a program that draw asymptotes?

Somehow like green plot:

Cornel_1-1720428495998.png

 

Cornel
19-Tanzanite
(To:Cornel)

@LucMeekes  I made a simple example also including the phase of the bode plot drawn in asymptotic manner in order to see what I want to achieve. 

Cornel_6-1720451261370.png

 

Cornel_7-1720451269369.png

 

Cornel_8-1720451277385.png

 

Cornel_9-1720451284747.png

 

So, for magnitude seems ok your program. Now a program for phase will be good to have...something like your program Asymptotes but modified for phase in order to have the result like PhaAsymp.

 

ttokoro
20-Turquoise
(To:Cornel)

image.pngimage.png

LucMeekes
23-Emerald III
(To:Cornel)

It's getting close:

LucMeekes_0-1720476129908.png

But not completely there yet:

LucMeekes_1-1720476159371.png

Luc

Cornel
19-Tanzanite
(To:LucMeekes)

Luc, can you attach your worksheet? It seems pretty ok at first view. Do not not sure why you said that "is not completely there yet"

LucMeekes
23-Emerald III
(To:Cornel)

See what happens if you change the lower bound of the frequency range from 10^-3 to 10^-1 (or higher).

 

Luc

Cornel
19-Tanzanite
(To:LucMeekes)

 I see that at least asymptotical magnitude bode plot works ok (see below). Why do you think its not ok?

I cannot say anything about asymptotical phase bode plot because you did not post until now your file to see how you implemented this asymptotical phase bode plot in order to see if changing the lower bound of the frequency range have an influence or not on phase plot.

This is with 10^-3:

Cornel_2-1720596523601.png

 

This is with 10^-1:

Cornel_1-1720596509171.png


This is with 10^2:

Cornel_3-1720596615610.png

LucMeekes
23-Emerald III
(To:Cornel)

Ah,  you're right.

I'm talking about this:

LucMeekes_0-1720605538687.png

Compare that with the previous plot, where frequency started at 10^-3.

I'm still working on this problem.

 

Luc

Cornel
19-Tanzanite
(To:LucMeekes)

Hm...I see what you are trying to explain (below with orange). Do not know what to say about this. There is some difference, but not so big (at least for the function on which this example is based).

Cornel_0-1720608342078.png

 

It could be also something like below to draw a straight line at each root, but I do not know how to automatically take into account this.

Cornel_2-1720609233391.png

Cornel_4-1720609320204.png

 

Because for a system like below there will be a -90deg drop:

Cornel_6-1720609382005.png

Cornel_7-1720609435131.png

 

 

Cornel_5-1720609373418.png

 

But anyway, when you finish your program to draw also the asymptotic phase plot post here. And even if you not finish the program post anyway here (maybe these differences will not be so big)

Cornel
19-Tanzanite
(To:LucMeekes)


@LucMeekes wrote:

Ah,  you're right.

I'm still working on this problem.

Luc


Hi Luc, could you post the asymptotic phase bode plot? (of course as it is by now)

LucMeekes
23-Emerald III
(To:Cornel)

So, after some fumbling I was able to improve the automatic asymptote generation for bode plots.

LucMeekes_0-1723498762802.png

The function should work fine for most real-world examples of filters,

as an example:

LucMeekes_1-1723498840000.png

or, another example:

LucMeekes_2-1723499032989.png

The option to supply H as a 2-column vector should work well if you import data from a circuit simulation program (Spice) to plot.

See attached file, which also works in Prime express. (Yes, all it took was a one-liner.)

 

Success!
Luc

Cornel
19-Tanzanite
(To:LucMeekes)

Ok, Thanks Luc very much.

Announcements

Top Tags