Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
Hi,
I am fairly new to Mathcad and I am trying to do the following from the data sheet. I need to make both of these plots and haven't got a clue where to start. If anyone can help it would be REALLY appreciated.
Here's a MC 15 file that I have for error amplifier gain.
I tried translating it to Prime, but I only have P2 & it doesn't work...
You can try translation to P3 & see if there is an improvement.
The main problem is that I pass the bode program a function reference & P2 doesn't appear to support that.
It should be possible to work around this, the bode function was mainly to fix the plot at 0°/360° transitions
hope it helps.
regards
Andy
PS: If you get it working, can you let me have a copy?
Hi Andy,
Andy here. In your excellent Amplifier Gain file, it's not clear to me what the nested vectorization inside the bode function accomplishes. When I eliminate the outer vectorization from your bode program, the output does not change. Is there something esoteric about the outer vectorization that this neophyte is missing.
Probably not, I had tried various things to get the result I wanted & once it worked the old engineering adage took over.
If it works, ... don't mess about with it .
If removing the outer vectorisation works then go with it, the file was only for an example & all improvements are welcomed.
Regards
Andy
Most of my questions are out of ignorance versus critique. I learned a great deal from you program. Thanks again.
Unfortunately that's a Mathcad 3.1 file, and I have Mathcad 3.0, so I can't read it. That's kind of ridiculous, but even more ridiculous is that you can't save it back to 3.0 format. PTC essentially forbids those with Prime 3.1 from cooperating with those with Prime 3.0.
So I don't know what you have tried so far. You do have S as a complex frequency, right (as in Andy's worksheet)?
This is what I have done so far, what do I need to use to write the bode TF s part??
You are trying to plot a funtion of s VS a w variable. That definitely won't work.
Here is my template for bode plots, that can probably help.
Thanks Adrian, yes it clear up it for me. The only part that I get confused with it equating everything that I have (e.g Gco and Gopto) with all of these recommendations. I dont know where to start with it really I can see the gain and phase relationship with C, but how tht transposes with the Gco and Gopto loses me a bit
I don't know what to think, I don't really know what you are trying to do. I mean, I know what an optocoupler is, but what Gco relates to, I don't understand, there is not enough information for me to understands the physics of what you are doing. Perhaps if you had a bit more documentation...
Hi Adrian,
I've tried your way but where am I going wring with this? Says this value must be scalar or matrix
My fault. There is a unit issue : your formula assumes an s in rad/s, and I have defined a unitless w. if you add a rad/s unit in the w definition, it all works fine.
BTW, I copied your screenshot into a mathcad prime 3.0 sheet, so that other people can read it ...
You have omega on the x axis and a function of s on the y axis. Mathcad has no idea what to do with that. You need to define a complex frequency, s, as a function of a real frequency, f (i.e. s(f)). Then a function of s, G(s), can be rewritten as a function of f, G(f). Since G is a function of a complex frequency it is complex, so you can't just plot G(f) vs f. One of the plots you want (the gain) is the magnitude of G (the square root of the sum of the squares of the real and imaginary parts), and the other plot (the phase) is the arctan if the imaginary part divided by the real part. You will also have to scale the gain as shown in your equation 112 to get it on a dB scale.
Sorry, but it's hard to help without the worksheet. You can blame PTC for that. Are you committed to using Mathcad Prime for this, or could you switch to Mathcad 15 (your license for Prime also allows you to run Mathcad 15)?
one thing you could try is to change the "s" for the graph to "j * w.i" , this should be functionally equivalent.
just a bit messier.
Another point to note is that the G(s) functions should multiply, not add.
The addition would only work if they are log based & you haven't done that transformation yet.
I am only using the trial version of mathcad prime, I'm looking at whether it can be of any use for our company or not with transfer function calcs will I be able to transfer over what I have done or have to re-do it all again?
You should be able to use my template for your transfer function calculations. It doesn't use any feature that is in the paid version of Mathcad. (In fact, I did it when I was evaluating Mathcad before purchasing it myself).
Alternatively, Maple has a bode function, that directly plots both magnitude and phase straight from a transfer function.
If you haven't purchased Mathcad yet, I strongly recommend that you try Maple before making a decision. It is a bit more expensive, the learning curve is a bit steaper, but if I was in a position to make this choice again,I would definitely go for Maple...
Mathcad can do what you are asking for (I've got a worksheet that does it, but I can't share it with you). I'm not sure what you mean by "will I be able to transfer over what I have done or have to re-do it all again?". If you mean "can Mathcad 15 load your Mathcad Prime 3.1 file?", the answer is no.
Hi Liam,
Prime Express can almost do what you want. It's just that the arg() and Re() functions are not available in the express edition...So it's not even simple to build the functionality yourself.
Attached is the setup I've created in the Prime3.0 express edition.
Success!
Luc
Thanks Luc!!!!!,
This is brilliant help,how would I go about plotting the phase for this, is there a way to scale the dB so it is on one side and the phase on the other? like as per below?
Hi Liam,
I'm not really fluent in Prime, more so in Mathcad (since version 2), so it took me a lot of time to build this, the interface appears to be intuiitive, but isn't always if you start using it. There appears to be no way to add a second axis, but it wouldn't help in your case either: As I indicated, you will not be able to obtain the phase using Prime express, since all functions that you need to get the phase of the expression with reasonable effort: arg(), Re() and Im(), are excluded from the express edition, they are 'premium' features. {Just type arg(2+3i)= or Re(2+3i)= and you'll see what I mean.}
You'd have to buy Prime to get those functions. But if you go that route, I'd suggest you use Mathcad 15 (which you get for free with buying Prime) instead of Prime because Mathcad 15 (and 14 and 13, all the way down to I'd guess 6) is much more powerfull than any existing version (and future version up to 4, maybe 5) of Prime.
The only thing I like about Prime is its automatic detection/tagging of units; type Hz:10*Hz and you'll see what I mean, the first Hz is a variable, the second Hz is a unit, as shown by typing Hz= below the previous assignment.
Success!
Luc
Hi Luc,
If I type arg(2+3i)= i get 0.983? Is that not right then?
Then you've got the full edition of Prime, not the express. You're probably in the trial period that may last for about one month, unless you buy the license...
OK, so you have access to arg (at least for now).
As there is no (obvious) way to add a second Y-axis to the plot, you'll need to make a second plot. Just copy the first and paste the copy below it. Then change the expressions for the Y traces from 'dBV' to 'arg', that should give you a plot with the phases. Done.
Success!
Luc
Yes that's what I did but I get which seemed a little off from what the data sheet got with the phase being from 0 to -270, not 0 to-3
Prime is assuming that the result is in radians.
in the units placeholder (following the arg(...) type deg - it should go blue)
This should force the plot to show 0 - 270 (ish)
you may need to adjust the scaling on the plot - click on the top or bottom numbers for the Y-axis scale - this allows you to specify max & min values
how do i change it so it shows -180 instead of -1.8*10^2?
no worries i found it
Ah, yes, forgot about that. You get the argument in radians. Divide the arg() by pi and multiply with 180, you can put that in front of it by typing 180/p[Ctrl-G]* just before the a of arg.
Or you can do as Andy suggests.
i get this when i do that
in the "unit" parenthesis, put the degree unit. Don't do the conversion yourself. Mathcad can do it for you, and he is less likely to make mistakes