cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

How to Calculate Gain and Phase

ssato
15-Moonstone

How to Calculate Gain and Phase

I have a question.

 

I want calculate Gain and Phase.

But I can not calculate Gain. Phase is OK.

??? I want to attach MATHCAD file. But I do not know how do I attach the file the message.

 

Please advise me.

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:Werner_E)

Here is your first file "repaired" using vectorization and made some changes with s (similar to waht you did in your last file)

View solution in original post

20 REPLIES 20
ppal
17-Peridot
(To:ssato)

Load File.png

 Use "Choose File" button to load a file or use photo to load pictures.

ValeryOchkov
24-Ruby IV
(To:ppal)


@ppal wrote:

Load File.png

 Use "Choose File" button to load a file or use photo to load pictures.


By me it does not work!

ssato
15-Moonstone
(To:ValeryOchkov)

I tried attached MATHCAD file. But the followind message is appeaerd.

 

The attachment's question.xmcd content type (application/x-mathcad-xmcd) does not match its file extension and has been removed.

 

ssato
15-Moonstone
(To:ssato)

I have also confusion.

 

From community botton of resource tab on MATHCAD menu, the following URL is appeared.

But this URL is not available.

 

https://community.ptc.com/t5/PTC-Mathcad/ct-p/PTCMathcad

 

URL on MATHCAD menu is correct ?

LucMeekes
23-Emerald III
(To:ssato)

The forum has been moved to a new software, which means new (im-)possibilities.

I suggest you make a screen shot of your problem, save that as a picture file and attach it.

 

Success!
Luc

Werner_E
25-Diamond I
(To:ssato)

This forum software is quite new to all of us and there still are a lot of bugs.

Not being able to attach files with extension mcd, xmcd, etc. is one of them.

It should work if you put the file in a zip-file and upload the zip file.

I guess zip's are allowed - I'll try in this reply.

EDIT: Yes, it works. You see the attachment to the right of this text -->>

Its a shame that the used theme is wasting so much space.

ssato
15-Moonstone
(To:Werner_E)

I attached zip file.

 

Please advise me.

 

ppal
17-Peridot
(To:ssato)

How about as attached.

ssato
15-Moonstone
(To:ppal)

Thank you for your reply.

 

But I have another calculation. Please attached file.

In this calculation the formula of calculation is OK. It means absolution of complex is | | is no problem.

If possible I want to know this difference.

 

Best Rgs

 

 

Werner_E
25-Diamond I
(To:ssato)

> If possible I want to know this difference.

 You mean why your first file failed and your current file question_3 works OK?

This is mainly because in your older file f was a vector, not a range as it is in the new file.

vectors and ranges are quite different and often are mixed up.

I try to attach two articles which Stuart created quite a while ago.

 

To make the old file work you would have to vectorize the call GPA(f).

There also are some differences in the definition and use of function/argument s in the two files.

Werner_E
25-Diamond I
(To:Werner_E)

Here is your first file "repaired" using vectorization and made some changes with s (similar to waht you did in your last file)

ssato
15-Moonstone
(To:Werner_E)

Thank you for your adovise.

I am clear this calculations.

 

ssato
15-Moonstone
(To:ssato)

I have question again.

If possible, please advise me.

 

Phase (argument) is calculated by not vector.

Is this specification of MATHCAD ?

 

LucMeekes
23-Emerald III
(To:ssato)

Because the function argPA already transforms   f  to  s,  the last evaluation in Werner's attachment should should not be:

argPA(s(f)=

but instead:

argPA(f)=

 

Does that solve your problem?
Success!
Luc

 

ssato
15-Moonstone
(To:LucMeekes)

I understand your advise.

 

Thanks so much.

 

 

Werner_E
25-Diamond I
(To:LucMeekes)


@LucMeekes wrote:

Because the function argPA already transforms   f  to  s,  the last evaluation in Werner's attachment should should not be:

argPA(s(f)=

but instead:

argPA(f)=



Yes, you are right.

This evaluation was left over from ssato's first sheet and should have been deleted.

 

I understood that the question was why vectorization is not need for the phase calculation. See my answer below (oops, above, as we only have linear view here - confusing).

Werner_E
25-Diamond I
(To:ssato)


@ssato wrote:

I have question again.

If possible, please advise me.

 

Phase (argument) is calculated by not vector.

Is this specification of MATHCAD ?

 


The "feature" you experience here is called implicit or automatic vectorization.

Whenever an operation is a applied to vectors which is not defined or does not make sense vor vectors, Mathcad automatically uses vectorization - that means it applies the calculation singly to every element of the vectors (they must have same dimensions for this to work) and collect the result in a vector.

 

The calculation of the phase uses functions which are not defined for vectors and so Mathcad automatocally vectorizes. The calculation of the gain GPA(f) uses at first the absolute value of s(f). f is vector, s(f) uses no vector operation so its a vector, too, due to automatic vectorization, but the absolute value |s(f)| is defined for vectors, too, giving you the vector length. This consatnt value is now used for the further calcuation and this is the reason why without vectorization the result of GPA(f) ist constant 38.072.

With explicit vectorization |s(f)| means to apply the absolute value to every single element of s(f) and do the calculations with those values one after the other.

As a cocnlucsion: If you want vectorization done you are on the safe side if you apply it manually, even then if it would not be necessary as is the case in the phase calculation.

Here some examples:

Bild1.png

 

 

Examples:

 

 

Werner_E
25-Diamond I
(To:Werner_E)

Two additional remarks:

 

1) You don't have to define j. Its built-in and you can use either i or j. Using Menu "Format" - "Result" - "Display Options" you can chose what you want to see in an evaluation, i or j.

To use i or j you must type 1i or 1j without a space or multiplication dot between. If your expression uses something like 2.54j this works as well, as long as you type j immediately after the last digit. The 1 is not shown when you click outside of your expression, so all looks as it should be.

 

2) Instead of converting from radians to degree manually you should let Mathcad do the job. Simply divide by degree in the plot (see picture). Instead of the degree sign (which is easily available on my German Keyboard) you may also type "deg" (without the quotes). Writing f/Hz at the abscissa is not really necessary as 1/s is the default unit anyway, but I thought it looks better that way 😉

Bild2.png

 

 

ssato
15-Moonstone
(To:ssato)

Thank you so much for everyone.

 

I have another trouble.

A few days late , I will return to here, and reply your answer.

 

Werner_E
25-Diamond I
(To:ssato)

Maybe it would be a good idea to open a new thread for your new question.

Announcements

Top Tags