¿ªÔÆÌåÓý

Re: Using BV exp(), log() for numerical compression ,wrong result ?


 

Hi, Helmut:

Thank you for the suggestions, but if I use the IF() as you mentioned, x couldn't be recovered as it was before compression.
But your answer seems LTspice couldn't treat the negative value of nature log very well, which normally return the complex value, eg: log(-2) =?0.6931 +? 3.1416i.
As I said, LTspice couldn't see the complex (imaginary) parts. And treat it very well, as it should be treated in the normal math world.

Though I found another solution, it's using the dc-bias in the source signal, after recovered it, eliminate the dc-bias, this could be done well, too. But I am thinking, why LTspice couldn't treat those math functions equal-footing, alternatively, some math functions are biased, while some are? "NOT SUPPORTED/PARTLY SUPPORTED". Is it fair , unfair ?

Best regards,
---In LTspice@..., <helmutsennewald@...> wrote :

Hello,

You have used log() from negative numbers. Normal calculators will fail in this case.

I recommend to use an IF() to workaround.

V=IF(V(x)<1e-6,0,log(V(x))

Be aware that log() is the same as ln(). log10() is the logarithm base 10.

Best regards,
Helmut

Join [email protected] to automatically receive all group messages.