0
\$\begingroup\$

I have lots of sampled voltage signals data where I can plot them in MATLAB or write them to a text file for each sample.

I would like to use these samples to generate input signals in LTSpice instead of trying to mimic them.

Is it doable in LTSpice?

edit: My data samples on txt can be in the following format:

59.7435 5.0615

59.7437 5.0578

59.7440 5.0768

59.7443 5.1119

Where the first column is time stamps in seconds, and the second column is corresponding sampled voltages

\$\endgroup\$
2
\$\begingroup\$

If you can format the matlab data as a series of timestamps and levels you can use the PWL file option for a voltage or current source.

http://www.linear.com/solutions/1814

\$\endgroup\$
  • \$\begingroup\$ I edited my question. \$\endgroup\$ – user16307 Mar 2 '16 at 10:36
0
\$\begingroup\$

If your data is uniformly sampled, which it looks like it is, I would personally use the function in LTspice to read WAVE files.

To use it, add a voltage source to your circuit and as the voltage expression you enter:

wavefile="C:\path\to\your\file.wav" chan=0

This will reproduce the sampled signal efficiently with minimum storage space.

\$\endgroup\$
  • \$\begingroup\$ not wave file mine are txt files \$\endgroup\$ – user16307 Mar 2 '16 at 12:45
  • \$\begingroup\$ @user16307, then you can translate your data into a wav file. You should be able to do this in Matlab or whatever programming language you like, with a little research on the WAV format. \$\endgroup\$ – The Photon Mar 2 '16 at 17:09
  • \$\begingroup\$ why would i convert to wav if LTspice can already read txt? \$\endgroup\$ – user16307 Mar 2 '16 at 17:26
  • \$\begingroup\$ wav files (may) use less disk space, this could be a game changer for complicated signals. \$\endgroup\$ – Jasen Mar 4 '16 at 0:02
  • \$\begingroup\$ @user16307 Because you used the expression write them to a text file, I assumed that you had the data in some kind of raw, non-text format, and to make a text file you had to convert it anyway. If the dataset is tiny, and already in a file format that PWL can read, there's no need to convert it. \$\endgroup\$ – pipe Mar 4 '16 at 3:21

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.