cancel
Showing results for
Did you mean:
cancel
Showing results 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

1-Newbie

## Optimization of bandwidth and phase margin of a transfer function

Hi all, I have a question regarding the selection of a proper value for a parameter from a list based on the evaluation of its transfer function.

As shown here, if I have a variable a, whose value can be selected from a list. A transfer function TF(s,a) is an s-domain function including this variable. We can calculate bandwidth and phase margin of a selected value of "a". I am wondering if it is possible to specify the criteria for the bandwidth and phase margin, and let Mathcad follows these criteria and select the optimized value of "a" from the list?

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
23-Emerald III
(To:yhuang-3)

I've extended the ranges of a, b and c values to 9 values each, and made a few changes to the code to allow it to deal with imaginary numbers.

It takes a little while to calculate all 729 results, but you've got something to choose from !

Success!
Luc

11 REPLIES 11
24-Ruby V
(To:yhuang-3)

See if the attached file helps-

1-Newbie
(To:Werner_E)

Hi Werner, thank you for much for your help! Your solutions works well. Now can I ask for a more complicated scenario, by extending the numbers of variables to 3? Thank you!

24-Ruby V
(To:yhuang-3)

In this case, if you continue the brute force way of trying all combinations, you would make TF a function of b an c as well  -> TF(s,a,b,c):=...

The pickValue routine would have three options as arguments (one for a, b and c) and instead of the one for loop you would use three nested for loops (for a-options, b-options and c-options) and innermost again the same statements which calculates BW_OK and PM_OK and jumps out at the very first fitting combination found.

23-Emerald III
(To:yhuang-3)

Something like this...

Now lets put in the data:

And the result is (1st column holds the a values, 2nd column the b-values, 3rd column the c values

Then 4th column the fBW values, 5th column the Fu values and the 6th (last) column the phase margins):

Oh, mind. There are some imaginary frequencies. A good pick might be No 20:

Success!
Luc

1-Newbie
(To:LucMeekes)

Thank you LucMeekes! I though your solution provides all the calculated BW&PM for each combination. If I am using your code, would you teach me how to return the optimized a,b, c based on the evaluation of the calculated BW*PM results? Thank you!

23-Emerald III
(To:yhuang-3)

1-Newbie
(To:LucMeekes)

Hi LucMeekes,

I am using your solution plus the method provided by Werner to search the right solution, but I got some problems. Would you teach me how to solve it?

In my real case, I am use a 15 options parameter "C1" and 16 options parameter "R2", and I am able to calculate all the BW and PM in each case for matrix "Data" (it is a 240x4 matrix).

What I tried to do it is to find the raw index number "x" of data matrix, when BW and PM can meet the requirement.

However, it seems like I am not able to return the index number, while the error message showed "this value must be a vector".

Would you tell me what is wrong with my code? Thank you!

23-Emerald III
(To:yhuang-3)

I've extended the ranges of a, b and c values to 9 values each, and made a few changes to the code to allow it to deal with imaginary numbers.

It takes a little while to calculate all 729 results, but you've got something to choose from !

Success!
Luc

23-Emerald III
(To:yhuang-3)

OK. Now solve:

Hope this helps.

Success!
Luc

24-Ruby V
(To:yhuang-3)

Heres the modified version for my brute force attack which stops at the first fit.

Encounter a floating point error.

have no time to look at at the moment - maybe later

1-Newbie
(To:Werner_E)

Thank you Werner! I can solve my problems now using Luc's method.

Announcements
Top Tags