# yGate

Pauli Y gate

Since R2023a

Installation Required: This functionality requires MATLAB Support Package for Quantum Computing.

## Syntax

``g = yGate(targetQubit)``

## Description

````g = yGate(targetQubit)` applies a Pauli Y gate to a single target qubit and returns a `quantum.gate.SimpleGate` object.If `targetQubit` is a vector of qubit indices, `yGate` returns a column vector of gates, where `g(i)` represents a Pauli Y gate applied to a qubit with index `targetQubit(i)`.```

example

## Examples

collapse all

Create a Pauli Y gate that acts on a single qubit.

`g = yGate(1)`
```g = SimpleGate with properties: Type: "y" ControlQubits: [1×0 double] TargetQubits: 1 Angles: [1×0 double]```

Get the matrix representation of the gate.

`M = getMatrix(g)`
```M = 0.0000 + 0.0000i 0.0000 - 1.0000i 0.0000 + 1.0000i 0.0000 + 0.0000i```

Create an array of Pauli Y gates that act on qubits with indices 1 to 4.

`g = yGate(1:4)`
```g = 4×1 SimpleGate array with gates: Id Gate Control Target 1 y 1 2 y 2 3 y 3 4 y 4 ```

## Input Arguments

collapse all

Target qubit of the gate, specified as a positive integer scalar index or vector of qubit indices.

Example: `1`

Example: `3:5`

collapse all

### Matrix Representation of Pauli Y Gate

The matrix representation of a Pauli Y gate applied to a single qubit is

`$\left[\begin{array}{cc}0& -i\\ i& 0\end{array}\right].$`

## Version History

Introduced in R2023a