フィルターのクリア

Partial Measurement of a quantum system

17 ビュー (過去 30 日間)
John Vining
John Vining 2024 年 6 月 10 日
回答済み: UDAYA PEDDIRAJU 2024 年 7 月 23 日 4:12
Is there a way to introduce projective measurement in a circuit.

回答 (1 件)

UDAYA PEDDIRAJU
UDAYA PEDDIRAJU 2024 年 7 月 23 日 4:12
Hi John,
the following snippet shows how to do projective measurements.
% Create a quantum circuit with two qubits
circuit = quantumCircuit(2);
% Apply a Hadamard gate to qubit 1
circuit = hGate(circuit, 1);
% Perform a CNOT operation controlled by qubit 1 on qubit 2
circuit = cxGate(circuit, 1, 2);
% Perform a projective measurement on qubit 2
result = measure(circuit, 2);
% Access the measurement result (either 0 or 1)
measured_state = result.Result;
% Access the probability of obtaining the measured state
probability = result.Probability;
% Display the results
disp(['Measured state of qubit 2: ', num2str(measured_state)]);
disp(['Probability of measured state: ', num2str(probability)]);
you can refer qc toolbox: https://www.mathworks.com/products/quantum-computing.html

カテゴリ

Help Center および File ExchangeQuantum Computing についてさらに検索

製品


リリース

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by