Clear Filters
Clear Filters

Partial Measurement of a quantum system

11 views (last 30 days)
John Vining
John Vining on 10 Jun 2024
Answered: Quantum Computing on 4 Oct 2024 at 16:14
Is there a way to introduce projective measurement in a circuit.

Answers (2)

UDAYA PEDDIRAJU
UDAYA PEDDIRAJU on 23 Jul 2024
This answer was flagged by Quantum Computing
Hi John,
the following snippet shows how to do projective measurements.
% Create a quantum circuit with two qubits
circuit = quantumCircuit(2);
quantumCircuit requires MATLAB Support Package for Quantum Computing.
% 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

Quantum Computing
Quantum Computing on 4 Oct 2024 at 16:14
Hi John,
There is code on the File Exchange for computing expectation values that can be used for projective measurements:

Categories

Find more on Quantum Mechanics in Help Center and File Exchange

Products


Release

R2024a

Community Treasure Hunt

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

Start Hunting!