08-31-2012 03:10 AM
Hi,
I have a fomula like this:
Id = B*(Vg-Vt-0.5*Vd)Vd/(1+th1*(Vg-Vt))
and then I have three groups of (Vg, Id), as well as Vd value. What I want is the solution expression for Vt, B and th1.
I do not have Matlab so I asked my friend help to solve it for me. the command like the following:
>> syms Vd Vg1 Vg2 Vg3 Id1 Id2 Id3 th1 Vt B;
>> [th1,Vt,B]=solve('Id1=B*(Vg1-Vt-0.5*Vd)*Vd/ (1+ th1*(Vg1-Vt))','Id2=B*(Vg2-Vt-0.5*Vd)*Vd/ (1+ th1*(Vg2-Vt))','Id3=B*(Vg3-Vt-0.5*Vd)*Vd/ (1+ th1*(Vg3-Vt))','th1,Vt,B')
It works fine and I get the expressions. for example, Vt like the following:
Vt =
-.50000000000000000000000000000000*(2.*Vg1*Id3*Id2*Vg3-2.*Id2*Id1*Vg1*Vg3+2.*Id1*Vg3*Id2*Vg2+Id1*Vg1*Id2*Vd-1.*Id1*Vd*Id2*Vg2+Id1*Vd*Id3*Vg3-2.*Vg1*Id3*Id2*Vg2-1.*Id1*Vg1*Vd*Id3+Vd*Id3*Id2*Vg2-1.*Vd*Id3*Id2*Vg3-2.*Id1*Vg2*Id3*Vg3+2.*Id1*Vg1*Vg2*Id3)/(Id1*Id3*Vg3+Id1*Vg1*Id2-1.*Id1*Vg1*Id3-1.*Id1*Id2*Vg2+Id2*Vg2*Id3-1.*Id2*Id3*Vg3)
I copied this to the Labview fomula node, it runs without error. (for B and th1, I have to replace the "^" with "**"), but the results are not as expected.
Do I have to change anything else before I copy to the fomula node?
Appreciate if any someone can help me in this issue, or any other solutions for this in labview? Thank you.
08-31-2012 05:17 AM
Hi,
Can you show us the Matlab result and the LabVIEW result? You say the result is not as expected, what does that mean? I would say this probably has something to do with the syntax. Maybe LabVIEW expects "," instead of "." on the decimal numbers. Like 0,5 instead of 0.5. I'm not familiar with formula node, just making some guesses.
08-31-2012 08:13 AM
08-31-2012 08:15 AM
hi Even,
thanks for the reply.
actually the following Vt is part of the Matlab result. The B and th1 is too long to display here. I just copy them to the formula node with necessary inputs and run. The only thing I changed is replace the "^" with "**", as in labview "^" means exclusive or, not power.
I just wonder anything else need to be changed.
Vt =
-.50000000000000000000000000000000*(2.*Vg1*Id3*Id2*Vg3-2.*Id2*Id1*Vg1*Vg3+2.*Id1*Vg3*Id2*Vg2+Id1*Vg1*Id2*Vd-1.*Id1*Vd*Id2*Vg2+Id1*Vd*Id3*Vg3-2.*Vg1*Id3*Id2*Vg2-1.*Id1*Vg1*Vd*Id3+Vd*Id3*Id2*Vg2-1.*Vd*Id3*Id2*Vg3-2.*Id1*Vg2*Id3*Vg3+2.*Id1*Vg1*Vg2*Id3)/(Id1*Id3*Vg3+Id1*Vg1*Id2-1.*Id1*Vg1*Id3-1.*Id1*Id2*Vg2+Id2*Vg2*Id3-1.*Id2*Id3*Vg3)
08-31-2012 08:43 AM
09-02-2012 12:30 AM
Hi,
please check the attachment. It is actually a way of Vt calculation model called MM9.
I've checked with some data from customers, it seems the calculation is correct. (I need to confirm this with them again).
Thank you all.
regards,
muyuqiao
09-02-2012 04:08 AM
Hi muyu,
"it seems the calculation is correct."
Whenever I have to use formulas that are several screens wide when written I really appreciate to apply some basic math rules and to split those formulas into it's terms. Then I can (much easier) check the output of each term and it will be much easier too to convert those formulas into real G code!
It usually doesn't help to write "0.5" with ~30 digits when DBL datatype is used: DBL can only handle ~17 digits!