1
\$\begingroup\$

I'm interested in simulating a circuit using a stepped sine wave input. I want to sample a sine wave at regular intervals and have the output constant during each interval, making an output that looks like:

enter image description here

(pardon my silly Excel plot!)

What's the best way to do this? Is there an easy way to create a source that generates an output like this? Am I better off carefully looking at the frequency response of my circuit and comparing it to the frequency content of this input?

A solution relevant to LTSpice or Orcad would be ideal.

\$\endgroup\$
  • \$\begingroup\$ I've done a "real" circuit like that with a CD4017. Different value resistors from each output into an opamp. (Caution, for good cancellation of the lower harmonics you need to take the output impedance of the CD4017 into account.) \$\endgroup\$ – George Herold Oct 21 '14 at 13:21
4
\$\begingroup\$

LTspice has a 'sample' block which implements a simple sample-and-hold. E.g. the below circuit

enter image description here

gives this waveform: enter image description here

\$\endgroup\$
1
\$\begingroup\$

I am not sure about Cadenece Orcad but LTSpice will do for you.

LTSpice allows you to use the PWL(piece wise linear) format to plot customized waveforms.

As a suggestion you can use PWL file which is a text file, store your data i.e. "what voltages at what time" in the text file. Take a general voltage source on schematic

voltage source

Right click on the voltage source to add your PWM file using PWL Tab. As an example I plotted waveform using the PWL.txt shown below.

> 0 0 1n .1 2n .5 3n 1.0 4n 1.5 5n 2.0 6n 2.5 7n 2.5 8n 2.0 9n 1.5 10n 1.0 11n 0.5 12n 0.1 13n 0 14n .1 15n .5 16n 1.0 17n 1.5 18n 2.0 19n 2.5 20n 2.5 21n 2.0 22n 1.5 23n 1.0 24n 0.5 25n 0.1

Waveform: wave

Similarly you can plot your customized waveform. I don't see exact data points on your waveform, or would have tried to plot waveform exactly like yours.

For more detail about PWL please follow the link from Linear.

Hope this helps.

\$\endgroup\$
  • 1
    \$\begingroup\$ Repeat each voltage value twice, at the start and end of the sample period, to reproduce a stepped waveform. Allow a small time (say 1 ns) between the end of a sample period and the start of the next. \$\endgroup\$ – Brian Drummond Oct 21 '14 at 9:15
0
\$\begingroup\$

Micro-cap has a component called "sample and hold" so, if you feed in a sinewave, the output will be a sampled version of the sinewave. Micro-cap also has the facility to have user-defined signal sources.

Like AKR I cannot give recommendations for OrCAD because I don't use it.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.