solve

Run kinematic analysis for KinematicsSolver object

Description

[outputs,statusFlag,targetFlags,targets] = solve(ks,targets,initialGuesses) solves, or attempts to solve, the kinematic problem posed in the KinematicsSolver object ks. The unknowns are the variables assigned as outputs in ks. Their solution hinges on the initial position constraints of the model and on the position targets of the object. When multiple solutions exist, position guesses bias the solver toward one over the others.

Input Arguments

collapse all

Name of the KinematicsSolver object for which to run the analysis. The object is a kinematic representation of the model from which it derives. It contains the variables upon which the analysis depends.

Example: 'fourBarKS'

Data Types: char | string

Desired values of the target variables of ks. Specify the values in the order of the variables as shown in the targetVariables table. The values are interpreted in the units listed in the table. If no target variables exist, enter an empty vector. If neither target nor initial guess variables exist, enter an empty vector or omit the argument altogether.

Example: '[0 45 30]'

Data Types: double

Values of the initial guess variables of ks. Specify the values in the order of the variables as shown in the initialGuessVariables table. The values are interpreted in the units listed in that table. If no initial guess variables exist, enter an empty vector or omit the argument altogether.

Example: '[10 25]'

Data Types: double

Output Arguments

collapse all

Computed values of the output variables. The variables show in the order of their ranking in the outputVariables table. They are each in the units listed there.

The solution may not satisfy all position targets or even all model constraints. Check the statusFlag argument for an overview of the issues encountered in the solution.

Data Types: double

Flag with the overall status of the analysis results. A positive flag means that all target variables and model constraints have been satisfied. A negative flag means that one or more have not. See the targetFlags argument to check which of the targets the solver may have missed. See the targets argument to see the actual values reached for each.

  • 1:

    All model constraints and target variables are satisfied.

  • 2:

    All model constraints and target variables are satisfied. A joint or belt-cable network may be in a singular configuration, however—due to gimbal lock in the former or a zero belt-cable length between pulleys in the latter.

  • -1:

    All model constraints are satisfied, but one or more target variables are not.

  • -2:

    All model constraints are satisfied, but one or more target variables are not. At least one joint or belt-cable network is in a singular configuration—due to gimbal lock in the former or a zero belt-cable length between pulleys in the latter.

  • -3:

    One or more model constraints cannot be satisfied. The solution is invalid. The output variables are NaN.

Data Types: double

Logical flags with the status of each target variable. A logical 1 indicates that a target has been satisfied. A logical 0 indicates that it has been missed. The flags show in the order given in the targetVariables table of the object. The vector is empty in kinematic problems without target variables.

Data Types: double

Computed values of the target variables of ks. These are the same target variables specified in the input arguments. The variables show in the order of their ranking in the targetVariables table. They are each in the units listed there.

Data Types: double

Introduced in R2019a