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.

Is possible to execute the Steady-State Analysis from simulation script?

+1 vote
I want to write a script that allow to execute the steady state analysis by varying one or more parameters for simulations.

Is possible to do this?

Best regards
asked Feb 3 by lrubino01 (17 points)
edited Feb 5 by lrubino01

1 Answer

+1 vote
Best answer

Hello Irubino01, 

There is a good example in the Documentation in the chapter Simulation Scripts:

mdlVars = struct('varL', 50e-6);  
opts = struct('ModelVars', mdlVars);  
plecs('scope', './Scope', 'ClearTraces');  
inductorValues = [50, 100, 200];  
for ix = 1:length(inductorValues)  
  opts.ModelVars.varL=inductorValues(ix) * 1e-6;  
  out = plecs('simulate', opts);  
  plecs('scope', './Scope', 'HoldTrace', ...  
        ['L=' mat2str(inductorValues(ix)) 'uH']);  
  [maxv, maxidx] = max(out.Values(1,:));  
  printf('Max current for L=%duH: %f at %fs\n', ...  
         inductorValues(ix), maxv, out.Time(maxidx));  

Adjust example according to your circuit and instead of

plecs('simulate', opts) 


plecs('analyze', 'analysisName', opts)

where 'analysisName' is the Description string of your Analysis.

Best Regards, 
answered Feb 5 by Falk Kyburz (152 points)
selected Feb 6 by lrubino01

Thank you for your reply, but I need other informations to apply your method. Starting from your suggestion,


>plecs('analyze', 'analysisName', opts)

>where 'analysisName' is the Description string of your Analysis.

where can I found the syntax for the description string?

Best regards


Hello Luigi,

Have a look at the attached minimum example. This should get you started.