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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Capacitor model unit issue

Bogdan_d
4-Participant

Capacitor model unit issue

Hi,

I am trying to model a capacitor based of the input values for L and R and plot the results.

If I plotting unit-less then the calculation is OK, others I get wired values for Xc and Xl.

Can somebody can point me where is the problem?

1 ACCEPTED SOLUTION

Accepted Solutions
ttokoro
20-Turquoise
(To:Bogdan_d)

11 REPLIES 11

Are you looking at this?

Cornel_0-1710518458592.png

 


@Bogdan_d wrote:

Hi,

I am trying to model a capacitor based of the input values for L and R and plot the results.

If I plotting unit-less then the calculation is OK, others I get wired values for Xc and Xl.

Can somebody can point me where is the problem?


Yes 🙂

You assign the unit MHz TWICE! So "freq" ends up with unit Hz^2 or 1/s^2

You have two options to assign the unit just once, either in the "logspace" function or as a factor after it, but not both!

Werner_E_0-1710519685132.png

 

ttokoro
20-Turquoise
(To:Bogdan_d)

image.pngimage.pngimage.pngimage.pngimage.png

Bogdan_d
4-Participant
(To:ttokoro)

Hi,

Thank you to all for your quick answer.

I am still not able to plot the values. It is drive me crazy. For such a simple thing, I still cannot find error.

ttokoro
20-Turquoise
(To:Bogdan_d)

Attach it.

Bogdan_d
4-Participant
(To:ttokoro)

Hi,

I understood your answer, now I am struggle with unitless values in the plot representation.

It is curious that  after I downloaded your file and open as it is is working, if I delete and try to apply the same what you did I start to have again issues.

For sure I am doing something wrong and cannot catch the point. I have look on the post here with unitless problem, but still I cannot fix it.  I do miss something here.

ttokoro
20-Turquoise
(To:ttokoro)

Add with vectorisation.

LucMeekes
23-Emerald III
(To:Bogdan_d)

You are plotting, but the |Xc(w)| takes the norm of the vector, which is a single value. You can see the point at w=0, |Xc(w)|=0.5

If you want the result to be a vector, you have to vectorise the expression, so make it:

LucMeekes_0-1710787623961.png

Then you get:

LucMeekes_1-1710787675943.png

And on a log/log plot you get the (probably) expected:

LucMeekes_2-1710787783591.png

 

Success!
Luc

Bogdan_d
4-Participant
(To:LucMeekes)

Hi,

Yes, for a matrix with vectors you have to vectorize the multiplication of them to have them one by one multiplied.

LucMeekes
23-Emerald III
(To:Bogdan_d)

This has little to do with 'multiplication', it's rather about an operation, namely |x|, that takes the absolute value if x is a scalar, but it takes the norm when x is a vector. If you want instead that the absolute value of each of the vector elements is taken, you have to apply vectorisation.

LucMeekes_0-1710801036004.png

You can also do what ttokoro did, and that is index your vectors. Note that he plotted |Xc(w.i)| versus w.i, in which case the argument to the absolute value is again a scalar, and no vectorisation is needed. But this requires that you define the index i.

LucMeekes_0-1710802151580.png

 

Success!
Luc

 

Bogdan_d
4-Participant
(To:LucMeekes)

Hi,

Thank you to all for your help.

The issue was that in the end I didn't catch under the vector also the modulo.

Top Tags