# How to Generate Three-Phase Sine Wave in MATLAB

## Introduction

We are going to explore how to generate a three-phase waveform in MATLAB. This tutorial will guide you through the steps to create a three-phase sine wave, including setting the amplitude, frequency, and phase angles.

## Setting Up the Environment

To begin, open a new MATLAB window. Follow these steps to set up your working environment:

Open the

**Library Browser**Â from the MATLAB menu.Navigate to

**Sources**.Place the

**Sine Wave**Â block in the working area.

## Configuring the Sine Wave Parameters

We will configure different parameters for the sine wave:

**Amplitude**: Set to 1.**Frequency**: Set according to your requirements. For this example, we use 2Ï€Ã—12\pi \times 12Ï€Ã—1Â rad/s, which corresponds to a frequency of 1 Hz.**Phase Angle**: Set in radians.

Here is how to set these parameters in MATLAB:

**Amplitude**: Keep it as 1.**Frequency**: Use 2Ï€Ã—f2\pi \times f2Ï€Ã—f, where fffÂ is the desired frequency in Hz. For example, 2Ï€Ã—12\pi \times 12Ï€Ã—1Â for 1 Hz.**Phase Angles**: For a three-phase waveform, the phase angles should be 120 degrees apart. Convert these degrees to radians.

## Introducing Phase Angles

To introduce phase shifts of 120 degrees for each waveform:

For the first sine wave, set the phase angle to 0 radians.

For the second sine wave, set the phase angle to âˆ’120360Ã—2Ï€\frac{-120}{360} \times 2\pi360âˆ’120â€‹Ã—2Ï€Â radians.

For the third sine wave, set the phase angle to 120360Ã—2Ï€\frac{120}{360} \times 2\pi360120â€‹Ã—2Ï€Â radians.

## Combining the Three-Phase Waveforms

We need to combine these three waveforms using a **Mux**Â block to visualize them together.

Use a

**Mux**Â block with three inputs.Connect each sine wave to one input of the Mux block.

Add a

**Scope**Â block to measure and display the combined waveform.

## Simulating the Model

Connect the output of the Mux block to the Scope block.

Simulate the model to check the results. If the output is not as expected, adjust the

**Maximum Step Size**Â in the configuration parameters.

### Adjusting Configuration Parameters

Go to

**Configuration Parameters**.Click on

**Additional Parameters**.Set the

**Maximum Step Size**Â to 1Ã—10âˆ’41 \times 10^{-4}1Ã—10âˆ’4.Apply the changes and run the simulation again.

## Visualization of the Three-Phase Waveform

After simulation, you should see a proper three-phase sinusoidal waveform on the scope. If needed, you can change the frequency and amplitude of the sine waves:

**Frequency**: Adjust the frequency parameter to your desired value (e.g., 50 Hz).**Amplitude**: To change the amplitude dynamically, use a**Product**Â block to multiply the sine wave with a step signal.

## Example: Varying Amplitude

To vary the amplitude during the simulation:

Add a

**Step**Â signal block.Connect it to a

**Product**Â block.Configure the step signal to change amplitude at a specific time (e.g., from 1 to 0.5 at 0.1 seconds).

Connect the output of the Product block to the Mux block.

Simulate the model again to see the amplitude variation reflected in the three-phase waveform.

## Conclusion

Generating a three-phase sine wave in MATLAB involves configuring sine wave parameters, introducing phase shifts, combining the waveforms, and visualizing them using a scope. This method can be extended by varying frequency and amplitude as required.

## Comments