Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
Hi Experts,
I am a beginner to use Mathcad.
and I have a question about the flow chart.
Please see the below figure, I can do the below figure by using Matlab, but I am confused about how to use Mathcad to do the same thing, can someone give an example of how to do it, thanks.
Solved! Go to Solution.
Hi,
Here is the total solution from the article. It uses a solve block instead of the flow chart in steps 3 and 4
Problem inputs
Steps 3 and 4 are the flow chart iterations. In Mathcad they can be done using a solve block it takes care of all the iteration to a closed solution.
Cheers
Terry
I would suggest that you start a try and then post the (probably not correctly working) worksheet here for corrections to be made.
There may be some modifications necessary because Mathcad unfortunately does not provide a loop with end-condition (something like do ... while, or repeat ... until). And of course Mathcad supports no goto 😉
You would also have to specify what "select ..." and "Find ..." and "solve for ..." would actually mean, how much m should be in/decreased, etc.
It might be that a solve block with "find" or "minerr" could be more appropriate to get the value of K.max (or rather m may be the value of interest?), but as a start here is a possible outline of the function. Arguments may be Qmax and m (so you won't need the first two lines). The third line is just to make sure that for the first time the condition of the while loop will fail.
Note that there is a slight difference here to the flow chart: When "Find Kmax" found a value equal to gain.required, the value of m is increased (which is not the case when we follow the flow chart. If this is an issue, an easy way to fix it would be to decrease m after the loop and before "solve for resonant ...".
Another way would be to replace "else" for "elseif Kmax > ganin.required".
Hi @Werner_E
Ok, I will put my worksheet next time when I have questions.
Based on your suggestions, I will try to do it and see if it could work or not.
because Matlab if more sensitive to me, it is hard for me to transfer to Mathcad.
and thanks for your help, I am very appreciate it.
You can find it in Mathcad Prime - "Writing If-Else If Statements": https://support.ptc.com/help/mathcad/r8.0/en/#page/PTC_Mathcad_Help/Tutorials/prgm_tutorial/task2-2_Writing_If_Else_Statements.html
As you did not provide a worksheet with a first try and also not stated which version of Mathcad you intend to use, I assumed it will be the current Prime (as Mathcad 15 fortunately is not available anymore anyway).
As you intend to use Mathcad 15 (older, but much more capable) instead of "ifelse" you can use "otherwise" (which is what normally is called "else" and then use a new "if" statement.
But I already suspected that other methods (solve block or root function) might be more appropriate compared to doing the iteration like in the flow chart. And I see that Terry already provided a full solution further down in this thread.
Hi,
Can you elaborate on the equations using Qmax and m to calculate Fxmin, Kmax. What is the required gain
Mathcad can use a root function or solve block that can iterate the value of m to solve the problem without using programming
Hi,
Are you using Mathcad 15 or Prime 8?
Cheers
Terry
Hi The web is a marvelous thing have found the article with the flow chart , So have the equations and example.
Application Note AN 2012-09
V1.0 September 2012
Resonant LLC Converter: Operation and Design
250W 33Vin 400Vout Design Example
Sam Abdel-Rahman
Infineon Technologies North America (IFNA) Corp
Please be patient
Hi,
Have programmed the equations from the article and reproduced the graphs
Figure from the article.
Figure from Mathcad 15 worksheet. Can be converted to Prime worksheet
Figure from the article
Calculation using root function for Fxmin and Kmax
Will now work through the example from the article to find m
Cheers
Terry
Hmm, reminds me of this thread (and the other two that were related): https://community.ptc.com/t5/Mathcad/Math-equation-problem-of-finding-too-many-different-answer/m-p/821733/highlight/true#M202462
Guess there could be a possibility that you are doing someone else's homework ....
Hi,
Thanks
It looks familiar clearly the same
Cheers
Terry
Hi @Werner_E,
I also see this article too, so I try to use this way to draw my figure.
I don't do anyone's homework, because I am recently learning how to design the LLC converter, so I will do some research on the PTC community.
Sorry to let you misunderstand.
Thanks, I also find other article talking about how to draw the figure, and your file is ok with me, I will keep studying how to finish my flow chart, thanks.
Hi,
Here is the total solution from the article. It uses a solve block instead of the flow chart in steps 3 and 4
Problem inputs
Steps 3 and 4 are the flow chart iterations. In Mathcad they can be done using a solve block it takes care of all the iteration to a closed solution.
Cheers
Terry
@terryhendicott
May I know what does below equation mean?
I try to use "help" to know the unifspace, but I don't find it.
Hi,
"unifspace" is a user defined function (not in help) that creates a matching range variable and a column scalar vector of uniformly spaced points.
It is used in the solution to create 501 points from 0.1 to 10 to graph the lines in all the plots.
Hi @terryhendicott ,
Sorry to ask a question again,
May I know what's different between these two?
if I use fx I will get different results.
fx is a vector, but fx[ifx is not!
Try to vectorize the function calls of function K in the second plot where you don't use the index ifx and see what happens.
Hi,
It is a good question. The difference is subtle.
There are three ways to get the correct plot and one way to get the wrong plot,
I will show why you get the wrong plot and then the three ways to get the correct plot. All three are just as valid.
Wrong plot:
The subtlety that gets the wrong plot is that you can pass a defined function a scalar or a vector and the function will behave differently.
This function is defined as if Q, m, and Fx are scalar. But it will accept a vector for Q, m or Fx and get an entirely different value due to the now vector arithmetic that returns a vector result.
In short you should only pass a succession of scalar terms for Fx in K function to get the desired result.
The three correct ways to get scalar values of Fx into the graph.
One:
Use a range variable (this is not a vector) on each axis. The range variable is assumed by Mathcad as element by element arithmetic.
It enters a scalar value into the K function
Two:
Deliberately use the vectorization operator to ensure you get element by element scalar input into the K function
This is plotting two similar sized vectors against each other.
Three:
Use indexed element by element scalar input to the K function
This needs a defined index and a matching value vector. hence unifspace()
Cheers
Terry