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

Bode Plot: Mathcad 15 vs Mathcad 11

Cornel
19-Tanzanite

Bode Plot: Mathcad 15 vs Mathcad 11

Hello,

Shouldn't the graphs look the same?

CornelBejan_0-1624306109540.png

Thanks.

ACCEPTED SOLUTION

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

No, they should not.

 

You did not define the variable 'freq'. This means that you left it to Mathcad to pick a suitable range for frequencies when you created the 'autoplot' (which is a nice feature, but as all features: to be handled with care).

In the case of mathcad 11, it took a linear range, starting at 10 (maybe) and stepping to 10^9 with steps of 10^6. That is why there are no (additional) points in the range of freq between 10 and one million.

In the case of mathcad 15, it probably took a range of frequencies logarithmically spaced from 10 to 10^9 with maybe 20 points per decade.

If you add this,

LucMeekes_0-1624308908079.png

 

above the plot, tou your Mathcad 11 sheet, the you have defined freq as an array of frequencies, logarithmically spaced from 10  to 10^9 at 20 points per decade. And f is an index into that array.

Now all there is left to be done is to handle freq as an array in your plots, so add [f at the end each occurrence of freq in your plots.

Note that in mathcad 15 a function logspace() is available that can create a similar array.

 

Success!
Luc

 

 

View solution in original post

11 REPLIES 11
LucMeekes
23-Emerald III
(To:Cornel)

No, they should not.

 

You did not define the variable 'freq'. This means that you left it to Mathcad to pick a suitable range for frequencies when you created the 'autoplot' (which is a nice feature, but as all features: to be handled with care).

In the case of mathcad 11, it took a linear range, starting at 10 (maybe) and stepping to 10^9 with steps of 10^6. That is why there are no (additional) points in the range of freq between 10 and one million.

In the case of mathcad 15, it probably took a range of frequencies logarithmically spaced from 10 to 10^9 with maybe 20 points per decade.

If you add this,

LucMeekes_0-1624308908079.png

 

above the plot, tou your Mathcad 11 sheet, the you have defined freq as an array of frequencies, logarithmically spaced from 10  to 10^9 at 20 points per decade. And f is an index into that array.

Now all there is left to be done is to handle freq as an array in your plots, so add [f at the end each occurrence of freq in your plots.

Note that in mathcad 15 a function logspace() is available that can create a similar array.

 

Success!
Luc

 

 

Cornel
19-Tanzanite
(To:LucMeekes)

All the results below in the graphs are taken from Mathcad 11.

--------------------------------
With 

CornelBejan_10-1624340370714.png


Case 1:

CornelBejan_0-1624339881510.png

 

 

CornelBejan_1-1624339966104.png

 

Case 2:

CornelBejan_2-1624339995161.png

 

CornelBejan_3-1624340044779.png

 

Case 3:

CornelBejan_4-1624340084642.png

 

CornelBejan_5-1624340110549.png

 

CornelBejan_6-1624340125337.png

 

CornelBejan_16-1624340641799.png

 

CornelBejan_17-1624340708553.png

 

--------------------------------

Without:

CornelBejan_9-1624340327525.png

 

Case 1:

 

CornelBejan_11-1624340408426.png

 

 

CornelBejan_12-1624340462027.png

Case 2:

CornelBejan_13-1624340483601.png

 

CornelBejan_14-1624340534452.png

Case 3:

CornelBejan_15-1624340566511.png

 

CornelBejan_5-1624340110549.png

 

CornelBejan_6-1624340125337.png

 

CornelBejan_16-1624340641799.png

 

CornelBejan_17-1624340708553.png

--------------------------------


On the other hand, what I find a little strange is that in Mathcad 15 once I checked the box corresponding to the x-axis in which I specify to the graph that the x-axis represents a logarithmic axis then I don't have to create a variable for the x-axis so that I clearly specify that the x-axis is a logarithmic axis because I created a variable to do this, while, as you say, in Mathcad 11 I have to create such a variable even if I checked the x-axis box in which tell him that the x-axis represents a logarithmic axis.

Therefore why in Mathcad 15 I do not have to create such a variable to take into account that the x-axis represents a logarithmic axis (it is enough only if I specify in the graph properties that the x-axis represents a logarithmic axis), and in Mathcad 11 do I have to create such a variable that takes into account the fact that the x-axis represents a logarithmic axis (even if in the properties of the graph I checked that the x-axis is a logarithmic axis)?

And could you put a Mathcad 11 file with the implementation of the version you are talking about?
It would be useful for me to have an example as an example 🙂

(Attached is a Mathcad 11 File)

Thanks.

 

LucMeekes
23-Emerald III
(To:Cornel)

You forgot to put f as an index to freq every where you use freq in the plots.

 

Success!
Luc

Cornel
19-Tanzanite
(To:LucMeekes)

Aha. Ok. Good.
It seems to work like this, but still, the phase diagram (the second graph) does not look 100% like in Mathcad 15.

CornelBejan_0-1624345971474.png

Mathcad 15:

CornelBejan_1-1624346008791.png

From what I see, at high frequencies (> 1MHz) the graphics seem to look the same, but at frequencies below 1MHz things are not the same.

Why does it appear like that?

And something else:

I would like to pass these functions implemented in Mathcad 15 to Mathcad 11 (to work and have these functions in MC11 as well), but I see that there are some errors that I do not know how to solve.

CornelBejan_2-1624346516864.png

 

CornelBejan_3-1624346550569.png

 

CornelBejan_4-1624346571264.png

 

CornelBejan_5-1624346594005.png

Could you take a look here too?

Thanks.

Cornel
19-Tanzanite
(To:LucMeekes)

I made a typo when entering the index f at freq for the phase graph.

 

After I corrected it, it looks better now.

 

CornelBejan_0-1624354705202.png

 

CornelBejan_1-1624354742008.png

I saw that I can't exceed the value of 10^3, which I don't know if in all cases I won't have to exceed it.
Can it be expanded in any way? or to somehow overcome the limitation in this regard?

Therefore, it only remains related to this issue if you can look and have a solution/suggestion.

CornelBejan_2-1624354849470.png
Thanks.

LucMeekes
23-Emerald III
(To:Cornel)

The function 'matrix(n,1,max)' creates a vector of n elements, with values from 0 to n-1.

It is set as the exponent to 10, so 10 ^(matrix(10^3,1,max)/20), creates a vector of 1000 elements, starting at 10^0 (which is 1) and ending at 10^999/20 = 10^50 (and we're talking frequency here, so that would be Hz), that is way beyond the frequency range you are (most probably) interested in. If you want more points, divide them over the decades, by increasing the number 20 to 125, to reduce the frequency span to 8 decades (when n=1000).

Incidentally, this way of creating a vector with the matrix() function works in Mathcad 11 and in Prime, but not in Mathcad 15...

 

Success!
Luc

LucMeekes
23-Emerald III
(To:Cornel)

In Mathcad 11 you cannot define a (local) function within a program, as opposed to Mathcad 15. That means the first statement in both programmed functions "Cross_overFreq_of_Phase..." and "Cross_overFreq_of_Magnitude...", where you define the local function Arg()  causes an error.

One solution is to take that function separately, outside of either of the two functions. Which you did, but the function definition must be above those of the two Cross_over... functions.

Another solution is to write the expression out, there where you call the function.

I'd take the first option.

 

Then the next error is that the 'degree' symbol (°) is not defined, so you need to define that as well, also before the two Cross_over functions.

 

Now the functions work, but the interval you set doesn't work for the Cross_overFreq_of_Magnitude... call. It doesn't see your magnitude cross the 0 dB line (where magnitude is1).

 

Success!
Luc

 

 

Cornel
19-Tanzanite
(To:LucMeekes)

Did I understand correctly how to do it?

 

CornelBejan_0-1624474136784.png

 

CornelBejan_0-1624474343220.png

CornelBejan_1-1624474362017.png

Thanks.

Cornel
19-Tanzanite
(To:Cornel)

I think so, I just had to delete Arg() from inside the function:

CornelBejan_0-1624475380465.png

 

if I still have doubts, I write 

CornelBejan_1-1624475438748.png

 

Thanks.

 

Cornel
19-Tanzanite
(To:LucMeekes)

Do you even know other methods/variants of implementation besides that:

CornelBejan_0-1624479692441.png

?

Thanks.

LucMeekes
23-Emerald III
(To:Cornel)

There are many ways that lead to Rome (if not all).

 

LucMeekes_0-1624526492069.png

I wonder if this is equivalent to the function logspace as implemented in Mathcad 15.

Try out

LucMeekes_1-1624526572630.png

Hmmm. This is what Prime produces (and, if copied from Mathcad 15, I have my answer):

LucMeekes_0-1624526640944.png

I don't see the first decade end at 120.

Ah, the third parameter is the total number of points generated, instead of the number of points per decade.

To implement that you could:

LucMeekes_1-1624527081949.png

 

Success!
Luc

Announcements

Top Tags