Electronic – Behavioural source output gets distorted when coupled to an active device in LTspice

behavioral-sourceltspice

When I use a function with a behavioural voltage source to generate a varying PWM in LTspice, I first obtain the clean expected output:

enter image description here

But whenever I couple it to an op amp for instance(as in the below circuit), the output of the behavioural source(you see in blue plot PWM is not swept clean anymore) gets distorted so the op amp output as well. I tried a follower or a voltage dependent voltage source in LTspice or adding series resistances ect., but none of them worked.

Did anyone encounter such issue? This by the way is not about the function I use, I tried with other functions I have the same issue with behavioural voltage source output. Is there a way to stabilize/fix the output?

enter image description here

Best Answer

It looks like the difference in time step in conjunction with the fairly high frequency and limited screen resultion is causing aliasing, which you see as the average value "floating around" or periods of zero.

Set the Maximum Timestep under Edit Simulation Command to the same value for both runs and they should look identical for the source.