Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
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?
Solved! Go to Solution.
@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!
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.
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.
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:
Then you get:
And on a log/log plot you get the (probably) expected:
Success!
Luc
Hi,
Yes, for a matrix with vectors you have to vectorize the multiplication of them to have them one by one multiplied.
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.
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.
Success!
Luc
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.