• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Problem with generation of triangular wave

mANmAN01

New Member
Hi! I am working with comparator (In LTspice). I have to compare a sine wave and a triangular wave. The triangular wave should be at 2kHz frequency. So this should be the configuration for triangular wave:
120416

However, the results show that it is not a 2kHz frequency:-

120417
Last time I checked, 0.0005s was 2kHz. But not in LTspice. Why is it so?
 

rjenkinsgb

Well-Known Member
Most Helpful Member
Do you have a typo in the setup?

The rise and fall are 0.0025 seconds each; 2.5mS
 

alec_t

Well-Known Member
Most Helpful Member
Your rise and fall times are out by a factor of 10.
Welcome to ETO!
 

eTech

Active Member
Use:

PULSE(-1 1 0 250u 250u 1n 250u)

Or

Triangle_Wave.png

View .meas results in error log.

eT
 
Last edited:

unclejed613

Well-Known Member
Most Helpful Member
i don't have a machine in front of me that has LTSpice on it, so i can't verify this, but i think you can use the PWL (piecewise linear) source also
 

simonbramble

Active Member
eTech is right. You can use a pulse source with very slew rate limited edges to generate a triangular waveform. You have got it right. You just have the slew rate set to 2.5ms when it should be 0.25ms (250us). 0us ON and 500us off time and this gives you a triangular waveform... or use PWL
 

EE World Online Articles

Loading

 
Top