Co-simulation between the LTspice/Pspice the MATLAB for data logging

138 views (last 30 days)
I hope you are doing well.
In one of my projects, I am using LTspice software. However, the issue is that LTspice does not have automatic data logging options like MATLAB (i.e., TO workspace/scope logging) after finishing the simulation. In this scenario, I have the following inquiries:
  1. Is it possible to do a co-simulation between the LTspice and MATLAB/Simulink to capture the simulation output? If so, is there any reference model available to show this feature?
  2. On the web, I have found that it is possible to do a co-simulation between the Pspice and MATLAB. However, I did not find any reference model/demo model in the MATLAB documentation. Is there any reference model available to show the co-simulation between the Pspice and MATLAB that can be shared?
Thank you for your time and support.

Answers (1)

Pooja Kumari
Pooja Kumari on 28 Aug 2023
Dear Pranoy,
I understand that you are facing difficulty while co-simulating between LTSpice/Spice and MATLAB/Simulink.Co-Simulation between LTSpice and MATLAB is not possible directly. You can follow these steps to perform co-simulation between LTSpice and MATLAB:
  1. Design and simulate your circuit in LTSpice.
  2. Export simulation data in LTSpice by right-clicking on a waveform plot and Selecting “File>Export data as text” or you can export the data in different formats.
  3. Import Simulation data in MATLAB using “importdata” function. You can refer to the below documentation for more details: Load data from file - MATLAB importdata - MathWorks India
  4. Reading Simulation Data in MATLAB using “readmatrix” or “readtable”.For importing data in MATLAB, you can refer to the below documentations:
5.Process and analyse the data in MATLAB.
You can refer to the below documentations for linking LTSpice with MATLAB:
There is reference model available to show the co-simulation between PSpice and MATLAB and you can refer to the below documentation for reference models:
Regards,
Pooja Kumari

Categories

Find more on Fuzzy Logic Toolbox in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!