Please take a minute to review and accept our Terms of Use.
Welcome to the PLECS User Forum, where you can ask questions and receive answers from other members of the community.

Many technical questions regarding PLECS are answered on the Technical Solutions page of our website. Tutorial videos, specific application examples, and pre-recorded webinars are available on our YouTube page. Please follow us on LinkedIn for the latest Plexim news.

Multiple AC sweep simulation script

0 votes
44 views
I would like to run a multiple ac sweep simulation on a simple LCR circuit plotting phase in degree and gain in db with different values of L, i've found a way but i dont' know how to modify the script to print the gain in db

can someone help me?
asked Mar 26 by Ernesto Incerti (26 points)

1 Answer

0 votes

For an AC Sweep, an Impulse Response Analysis or a Multitone Analysis, the command returns a struct consisting of three fields, F, Gr and Gi. F is a vector that contains the perturbation frequencies of the analysis. The rows of the arrays Gr and Gi consist of the real and imaginary part of the transfer function as defined in the analysis.

To get the gain in dB, one can just convert the magnitude of the Gr+1j*Gi and convert.

R = plecs('analyze', 'AC Sweep');

R.Gc = R.Gr+1j*R.Gi;

dBGain = 20*log(abs(R.Gc))

 

 

answered Mar 28 by Bryan Lieblick (1,887 points)
...