About this worksheet:
This worksheet using PTC Mathcad includes an example of an engineer designing a hi-fi speaker that must meet a certain frequency response. The horizontal trend must be over the whole spectrum of the audible range with a tolerance of +/- 1dB. Because at least two transducers are needed, you must look at the case in which there is both a low and high frequency driver. You can calculate the impedances of each to determine the overall frequency response. This worksheet uses data from excel and plots the solutions.
Download and explore this worksheet yourself! You can download a free lifetime copy of PTC Mathcad Express and get 30 days of full functionality.
I am very new to Matchcad so these questions are very basic:
1. ORIGIN := 1 - What is it for?
2. Why there is an arrow above the absolute values of ZLF, ZHF and ZT?
3. Is "j" a reserve parameter in Matchcad for SQRT(-1)?
ORIGIN defines the starting index of vector and matrix elements. By default it is set to 0.
The arrow is to vectorize an expression. Look that up in the help.. without vectorization, using the |x| operator would give the length of the vector, producing a single number. With vectorization the result of that same operator is a vector with the absolute values of each of the elements.
The value i is the imaginary unit, such that i squared results in -1. You can use j for the same.
With your helps, I was able to plot the RC circuit in frequency domain. The problem is I would like to have the minor and major X-axis in log scale. How do you do that?
I searched in this Forum and found a solution Grids_for_Prime.mcdx, unfortunately it is a mess and I do not have a clue what is going on. Is there a better solution to plot log scale on the X-axis? Y axis is linear so I do not have problems with it.
Also from Grids_for_Prime.mcdx:
why we have this: G <--- [Nan Nan]
if axis = "y" and the following 2 lines (augment), can you explain what that means?
In Prime 6 you have the choice among two completely different plot abilities.
In your second file (RC_circuits.mcdx) you had chosen the newly introduced diagram component which, IMHO is a nightmare to use. Its very slow, does not support units (a no-go in a program like Mathcad Prime) and is quite unusable if you are using a laptop with a 4K display because the component does not scale accordingly.
On the other other hand the native 2D-plot in Prime has many drawbacks and missing features (labels, grid, 2nd y-axis,..) which PTC was not able or willing to implement so they rather purchased a third party plot module and integrated it (very poorly) in Prime. Not really understandable given that a major PTC product is a full fledged CAD software.
OK, enough of the ramble. That third party plot module you used supports log scaled axis but its not that easy to find out how. You have to double click the plot and wait (quite long) until the chart properties windows pops up.
You would expect finding the option for a log x-axis in the tab "X", but no! You have to chose the "axis" tab at the very top and chose "Style: Log/Linear" there. See the screenshot.
I think what you use is a routine I posted quite some time ago. But Luc also posted his own version for a grid making routine somewhere in the depth of this forum and as far as I remember his version would also work OK in Prime Express (which does not support programming).
I don't see why you think its a mess 😉
You may just copy the collapsed region into your worksheet and use the commands.
The routines were a quick hack and workaround because inexcusably Prime did not provide a mean to add something so simple a grid to a plot.
The routines create the data for a couple of lines which then when plotted form the grid. The output is a n x 2 matrix, where in the first column are the x-coordinates of the start and end points of the lines and the second column consists of the y-coordinates.
The [NaN NaN] inserted between every two lines is necessary as otherwise the end of one line would be connected with the start of the next one, creating a zig-zag pattern. BTW, NaN means "Not-a-Number".
"Grid" and "logGrid" create only a vertical or horizontal grid, depending on the first function argument being "x" or "y". You may assign each to a separate variable and plot both. So you could have the vertical and the horizontal grid lines in different colors and styles.
Usually this is not necessary and so both are combined using the "stack" command.
The augment command in the programs simply exchange the two columns of the created matrix if axis="y".
Thanks a lot for your helps and insight on PTC plotting features. Great I will try your suggestions:
"You may just copy the collapsed region into your worksheet and use the commands"
If it works, then I am good with it.
If not, I will try your 2nd suggestion from the screen shot you provided
For now, I will use the newly introduced plotting approach but thanks for highlighting the pro and con for each. I was wondering about them myself.
I said it is a mess because being a RF hardware engineering, I am not used to seeing such long codes for just log plots. Log plots are an essential tools for us in electrical engineering, especially RF engineering
Thanks for the helps
You are absolutely right - something basic like adding a grid should be just a click to a checkbox, maybe specifying the grid width, but nothing more. Especially given that we are talking about an engineering software.
Are you looking for something like this:
For further questions I suggest you open a new thread
Prime 6 worksheet attached
Remark: Your main question was how to get a logarithmic scale on the x-axis in the native Prime 2D-plot. You click on the expression for the x-axis ("freq" in your case) and in the "diagram" ribbon menu you click on "log scale"
The routines in Grids_for_Prime.mcdx have nothing to do with the ability to use a log scale - they are just a workaround to overcome the inability of the native Prime plot to add a grid to a plot.
I know you have an RLC file on the PTC.
I have a circuit problem I have gone over for a week. Could not get the answer.
I forced the process to make the answer work but that is make fit and I know its wrong.
I started on it with the differential equation mesh (loop equation) method.
I did not get matching answers. Then moved to the simpler initial condition method this was where I got closer. Case the answer maybe wrong, not likely.
Basically its the time constants here in the circuit there are two.
If you go by the usual RC and RL time constants usually the simple case is either one or the other is used, here its both. Circuit reduction helps but this circuit's situation is the current in each branch.
If you got can do it easily or are interested to solve it.
I like to see the solution.
It looks like you are looking for a symbolic solution. Unfortunately Mathcad and also Prime can't solve an ODE or a system of ODEs symbolically. You may get a numeric solution, though, using a solve block with "odesolve".
One way to get a symbolic solution is to setup the equations in the Laplace domain and use Mathcads "invlaplace":
Don't mind the red error when transforming i2. It the annoying "the expression is too large to display" message. In this case you could solve it by using "simplify,max" instead of just "simplify".
At least I know the answer is correct.
Setting up in ODE in the time-domain with substitutions for some variables did not do it for me.
It can be done. I may had made an error so it was lots of hours there. But you're saying its not possible and that only thru Laplace transforms could it be solved. That maybe true. The equation is so short. Paper and pencil cant do it? Meaning plain ODE.
The other way is thru the initial conditions and creating equations for integrating and differentiating terms. Meaning circuit operation step by step. I did that and got some numbers similar, but explaining the workings of the circuit was not straight forward - robust engineering. Something like forced the solution, but how does that match the circuit operation correctly, to meet the answer. So that was really what I was looking for the manual steps. However, you showed me there are improved features in Prime 6 now that's great. I may have to leave this problem out until I can fix it, frame it up, the solution like a painting. More frustrating then anything that it has two time constant and the circuit's operation.
This problem is also part of that under over and critically damped cases.
Where we set the time constant using L/R and RC. I tried to split the circuit into 2.
RC and RL. Forced it to match the answer in a sense.
The end condition is t>>0 where the L is short circuited and C open circuited.
Somethings did not flow well, and how do 2 time constant work in a circuit? I said one is L the other C, out of phase for L and C, they have same voltage (parallel) so the time constants subtract (out of phase). 1000-50 = 9950. The 100 was from another path of the circuit. So you see the thinking on it was get a path cut to the solution and force a circuit thinking on it.
If you got the time constant thru the roots of the equation(s), then it solves the answer but how does the flow of the time constants play in the circuit in the solution process, as in being taken into consideration, in the solution via the time constant expression L/R and RC ( 1/tau RL, and 1/tau RC). So that's what I meant by operation of the circuit. I did the differential equation way wrt to time, as you said that's not going to work, rather use Laplace transform. Good.
I did the sort of inspection and circuits way on initial conditions and splitting the circuit into 2 but my solution flow or the path is not correct I may have the numbers close enough. This I wrote to get my problem across beyond the Laplace transform solving for the roots. I was planning to look at it in some future time, shelved it, until you guys got thru with the answer! Good. May not be meant for me.
I am on Prime 2. So I cant open Prime 6.
> I am on Prime 2. So I cant open Prime 6.
Nonetheless you could install the trial version of Prime 6. For a couple of weeks it will work in full mode and after that time it falls back into the so called express mode where a lot of "advanced features" are disabled (like symbolic calculation, solve blocks, programming,..). But the express version of Prime still is able to open files made with the full version and show the calculations. So it can be used as a viewer for regular Prime files.
Freds sheet was entirely made using just features available in the express version - its not an analytical solution but a nice way to solve the equations numerically without using programming or solve blocks.
Installing P6 in parallel with P2 will at least disable the ability to convert worksheets from real Mathcad to P2 format - they will be converted to P6 format. I don't know if uninstalling P6 reverts that, so you may have to reinstall P2 to be further able to do the conversion.
I also don't know which other effect the installation of Prime 6 in parallel to your Prime 2 may have so I'd suggest that you install P6 either in a virtual machine or on a separate computer if possible.
Find attached a pdf print of Freds file. You may change a few values to get an even more accurate solution:
I have looked at it and will use it for my solution.
I am moving you up from Sapphire III to Bad Boy III.
Appreciate your effort in my problem.
The way you set it up may open new doors to circuit solving methods for circuits and other courses.
You wont find that in Matlab. And that Sir may be good!
All, Problem with the solution I had and some suggestions I got:
1. Need an equation to get the roots in line with over/under/critical damped format.
2. Equation had to generate 2 roots which represent the time constant.
3. Here these roots are s1 and s2.
4. Need simultaneous equations to solve for coefficients.
5. The circuit has L and C and for typical differential-integral equations that can be solved.
Here the loop equations posed a different solution thru substitution.
There maybe more points here to add. I do not have them at this time.
The attached file has some errors, maybe namely the form of expression as (Vo/R)e^-t/tau.
There need to be 2 time constants.
I suggested splitting it into RC and RL circuit.
One time constant for t=infinity and the other for 0<t<infinity.
Thru some assumptions, and strictly focussed toward the answers, led me to a loosely crafted solution with the answers matching.
I sense this maybe corrected to perfection by someone else.
Maybe the (Vo/R)e^-t/tau instead of (Vo/R)(1-e^-t/tau) form of expression.
Past this point I don't belief I am further interested in pushing it myself with a new insight.
At most maybe correct errors found here.
Long in number of pages but the read thru is short on time.
I may go thru next time to shorten it.