This topic shows how to generate MATLAB® code for linearization from the Linear Analysis Tool. You can generate either a MATLAB script or a MATLAB function. Generated MATLAB scripts are useful when you want to programmatically reproduce a result you obtained interactively. A generated MATLAB function allows you to perform multiple linearizations with systematic variations in linearization parameters such as operating point (batch linearization).
To generate MATLAB code for linearization:
In the Linear Analysis Tool, on the Exact Linearization tab, interactively configure the analysis I/Os, operating point, and other parameters for linearization.
Click Linearize to open the Generate Matlab Code menu.
Select the type of code you want to generate:
Script with current values — Generate a MATLAB script that uses your configured parameter values and operating point. Select this option when you want to repeat the same linearization at the MATLAB command line.
Function with input arguments — Generate a MATLAB function that takes analysis I/Os and operating points as input arguments. Select this option when you want to perform multiple linearizations using different parameter values (batch linearization).