querystates
Installation Required: This functionality requires MATLAB Support Package for Quantum Computing.
Syntax
Description
[
returns the possible states and the probability of measuring each state from the specified
quantum state or measurement. The input states,probabilities] = querystates(s)s must be a
QuantumState or QuantumMeasurement object.
If
sis aQuantumStateobject, thenquerystatesreturns each possible state and the probability of measuring that state.If
sis aQuantumMeasurementobject, thenquerystatesreturns each measured state and the estimated probability of that state.
[
specifies a set of qubits for which to find possible states and the probabilities of those
states.states,probabilities] = querystates(s,qubits)
[
specifies options using one or more name-value arguments in addition to any of the input
argument combinations in previous syntaxes. For example, you can choose the basis in which
each qubit is represented or a probability threshold to include states in the output.states,probabilities] = querystates(___,Name=Value)
Examples
Input Arguments
Name-Value Arguments
Output Arguments
Tips
To plot a histogram of possible states and their probabilities, you can use
histogram. Thehistogramfunction (with no output argument) has the same syntaxes asquerystates.
Version History
Introduced in R2023a

