optimizeDesign
Syntax
Description
Examples
Optimize Parameters for Second-Order DSM in Simulink
Define the performance specifications of a second-order DSM.
outputTable=table(); outputTable.Test=["ACMeas";"ACMeas";"ACMeas";"ACMeas";"ACMeas"]; outputTable.Name={'SNR';'SFDR';'SINAD';'ENOB';'NoiseFloor'}; outputTable.Weight=[100;40;35;90;15]; outputTable.Units={'dB';'dB';'dB';'bits';'dB'}; outputTable.Spec={'> 72';'> 74';'> 72';'maximize 11.5';'< -78'}
outputTable=5×5 table
Test Name Weight Units Spec
________ ______________ ______ ________ _________________
"ACMeas" {'SNR' } 100 {'dB' } {'> 72' }
"ACMeas" {'SFDR' } 40 {'dB' } {'> 74' }
"ACMeas" {'SINAD' } 35 {'dB' } {'> 72' }
"ACMeas" {'ENOB' } 90 {'bits'} {'maximize 11.5'}
"ACMeas" {'NoiseFloor'} 15 {'dB' } {'< -78' }
Define the variables to optimize.
variableTable=table(); variableTable.parameters={'a1';'a2';'b1';'b2'}; variableTable.values=["0.15:0.005:0.16";"0.55:0.005:0.7";"0.15:0.005:0.16";"0.55:0.005:0.7"]
variableTable=4×2 table
parameters values
__________ _________________
{'a1'} "0.15:0.005:0.16"
{'a2'} "0.55:0.005:0.7"
{'b1'} "0.15:0.005:0.16"
{'b2'} "0.55:0.005:0.7"
Create the msbOptimizer
object.
moptimizer = msbOptimizer(SimulationEnvironment='simulink',OutputsSetup=outputTable,VariableSetup=variableTable,DesignName='DSM2ndOrder')
moptimizer = msbOptimizer with properties: DesignName: 'DSM2ndOrder' Solver: "surrogateopt" SimulationEnvironment: 'simulink' BestSolution: [] BestMetrics: [] FinalOptimizerStatus: [] OutputsSetup: [5x5 table] ParametersSetup: [4x2 table] ParameterNames: ["a1" "a2" "b1" "b2"] ParameterValues: ["0.15:0.005:0.16" "0.55:0.005:0.7" "0.15:0.005:0.16" "0.55:0.005:0.7"] Eflag: [] Trials: [] Constraints: [5x11 table] ParameterScaleFactor: [0.0050 0.0050 0.0050 0.0050]
Optimize the parameters.
[sol,metric] = moptimizer.optimizeDesign
Maximum number of simulations: 64 Number of parallel simulations: 8 Running 8 simulations in Simulink... Running 8 simulations in Simulink... Running 8 simulations in Simulink... Running 8 simulations in Simulink... Running 8 simulations in Simulink... Running 8 simulations in Simulink... Running 8 simulations in Simulink... Running 8 simulations in Simulink... Optimizer was unable to meet some or all the specifications. You can continue optimization from the current state by using the checkpoint file. E.g., if your object is called 'optimizer', run the following command: [solution, bestMetrics] = optimizer.optimizeDesign('useCheckPoint',true)
sol=4×2 table
Name Value
____ _____
"a1" 0.155
"a2" 0.6
"b1" 0.155
"b2" 0.66
metric=5×4 table
Name FinalMetrics Specs Units
______________ ____________ _________________ ________
{'SNR' } 70.699 {'> 72' } {'dB' }
{'SFDR' } 80.248 {'> 74' } {'dB' }
{'SINAD' } 70.699 {'> 72' } {'dB' }
{'NoiseFloor'} -78.276 {'< -78' } {'dB' }
{'ENOB' } 11.452 {'maximize 11.5'} {'bits'}
As you can see, the function was not able to meet the required SNR amd SINAD specifications. You can use the check point file to continue optimizing from the current state.
Input Arguments
obj
— Circuit design to optimize
msbOptimizer
object
Circuit design to optimize, specified as an msbOptimizer
object The
object includes the name of the simulation environment, the name of the circuit design,
the performance specifications, and the variables to optimize.
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Example: [sol,metric] =obj.optimizeDesign(ProgressPlot='true')
optimizes the circuit design defined in the obj
object and shows the
optimization progress in a plot.
NumParallelSims
— Number of parallel simulations per iteration
8
(default) | nonnegative integer scalar
Number of parallel simulations per iteration, specified as a nonnegative integer scalar.
Data Types: double
MaxNumberSims
— Maximum number of simulations to run
64
(default) | nonnegative integer scalar
Maximum number of simulations to run, specified as a nonnegative integer scalar.
Data Types: double
MinSurrogatePoints
— Minimum number of random sample points to create at the start of a surrogate creation phase
32
(default) | nonnegative integer scalar
Minimum number of random sample points to create at the start of a surrogate creation phase, specified as a nonnegative integer scalar.
Data Types: double
ProgressPlot
— Show optimization progress
true
(default) | false
Show optimization progress in a plot.
Data Types: logical
CheckPointFileName
— Name of file to create checkpoints and restart optimization
myCheckPoint
(default) | string | char vector
Name of the file to create checkpoints and restart the optimization process, specified as a string or char vector.
UseCheckPoint
— Use checkpoint file for optimization
true
(default) | false
Use the checkpoint file for optimization. The function can only use this argument after the creation of a checkpoint file at the end of a simulation run.
Data Types: logical
solver
— Optimization solver
surrogateopt
(default)
Optimization solver used to optimize circuit parameters. You can only select
surrogateopt
.
ObjectiveFunction
— Handle to objective function
object handle
Handle to objective function that evaluates the objective.
InitialPoints
— Initial points for surrogate optimization
[]
(default) | matrix | struct
Initial points for surrogate optimization, specified as a matrix or struct.
Data Types: double
RngSeed
— Random number generator seed
1
(default) | nonnegative integer scalar
Random number generator seed, specified as a nonnegative integer scalar.
Data Types: double
RngAlgorithm
— Random number generator algorithm used by optimization solver
twister
(default) | string
Random number generator algorithm used by optimization solver, specified as a string.
Data Types: char
Output Arguments
sol
— Optimized variables or parameters
table
Optimized variables or parameters, returned as a table. The elements of the table
matches the variables or parameters defined in the VariableSetup
argument in mbsOptimizer
object.
metric
— Performance metrics using optimized variables or parameters
table
Performance metrics using optimized variables or parameters, returned as a table.
The elements of the table matches the variables or parameters defined in the
OutputsSetup
argument in mbsOptimizer
object.
Version History
Introduced in R2024b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)