Installing and using LTspice IV (now including LTXVII), From beginner to advanced

Here's an example. It shows the ideal 0% distortion.

The math for the timestep is: sample time / 262144.

So, four cycles at 1KHz is 4ms / 262144 = 15.25878906ns. This is probably an overkill. You could use some factor of 262144 and likely get the same result. I'm also starting after 1 cycle to let the initial operating conditions settle. Probably not needed in a circuit like this without any capacitors. But its shown for illustrative purposes.
 

Attachments

  • example.PNG
    example.PNG
    26.2 KB · Views: 311
Last edited:
Hello, Can you help me setup a asc file to measure distortion for a simple jfet gain stage?

This file is about as simple as it gets; a simple common source JFET stage. LTspice has a built-in model for the 2N5484 so this file will simulate without any external files.

The stage is set up for a gain of about x10. The key to getting a distortion chart is the .four statement. This statement tells LTspice to measure harmonic distortion at the Out terminal at 1 KHz, and to include 10 harmonics in the analysis. After performing a transient simulation, press Ctrl-L to bring up a "log" file; this will display a THD chart.

You can also look at the distortion products in the waveform display. From the "View" menu click on the FFT item and then select V(out) as the waveform you want to examine.

I hope this is helpful.
 

Attachments

Which post is the file in?
Thank you. It's in post 823.
This file is about as simple as it gets; a simple common source JFET stage. LTspice has a built-in model for the 2N5484 so this file will simulate without any external files.

The stage is set up for a gain of about x10. The key to getting a distortion chart is the .four statement. This statement tells LTspice to measure harmonic distortion at the Out terminal at 1 KHz, and to include 10 harmonics in the analysis. After performing a transient simulation, press Ctrl-L to bring up a "log" file; this will display a THD chart.

You can also look at the distortion products in the waveform display. From the "View" menu click on the FFT item and then select V(out) as the waveform you want to examine.

I hope this is helpful.
Thank you so much for taking the time to setup this for me ! I think I understand better with these explanations.
To use it I run the simulation. I right clic on the waveform then select "view > FFT". And then to have the actual numbers I view the error log. Right ?
 
Thank you. It's in post 823.

Thank you so much for taking the time to setup this for me ! I think I understand better with these explanations.
To use it I run the simulation. I right clic on the waveform then select "view > FFT". And then to have the actual numbers I view the error log. Right ?

:up: got it, and yes, right click and FFT and Error Log.

Try and follow posts 19 and 20 in this thread:
Installing and using LTspice IV (now including LTXVII). From beginner to advanced.

One thing we can do is to increase the coupling cap value in the sim which will greatly improve the FFT result. Lets make it '1' which is 1 Farad (don't use 1F which is actually 1 Femto Farad).

We will also run the sim for much longer, say 800ms and save data from say 400ms. Now we can get an FFT like this.
 

Attachments

  • Annotation 2020-06-14 064631.jpg
    Annotation 2020-06-14 064631.jpg
    291.1 KB · Views: 237
  • Annotation 2020-06-14 064835.jpg
    Annotation 2020-06-14 064835.jpg
    132 KB · Views: 245
Thanks, but my example wasn't intended to present the best possible circuit. I was answering a question about how to display distortion in a JFET stage and showed the simplest circuit I could produce for that purpose. But your modification is a nice circuit for someone that is trying to build a real JFET gain stage.