# Generating Signals in Simulink | Simulink Tutorial

**SIGNALS**

### Introduction

A Signal is a function that conveys information about some attribute or behavior in some phenomenon with respect to variations in time or space. Signals as referred to in communication systems or control systems or any field in electrical engineering as a whole can be a time-varying quantity and it has values at all point in time.

**Generating Signals in Simulink: **

Various signals can be generated in the Simulink model. The different source blocks provided in the Simulink Library help us build different signals. We can alter the parameters of the signals according to the applications.

**The Signal Generator block:**

It can produce one of four different waveforms: sine wave, square wave, sawtooth wave, and random wave. You can express signal parameters in Hertz (the default) or radians per second.

>> Simulink library>>Simulink>>Sources>>Signal Generator

**The Sine Wave block:**

It outputs a sinusoidal waveform. The block can operate in time-based or sample-based mode.

In time-Based Mode, the output in this mode is calculated at every instant during the entire simulation time period using the following equation.

*y=amplitude×sin(frequency×time+phase)+bias.*

In sample-Based Mode, the output in this mode is calculated only at fixed time intervals using the following equation.

*y=amplitude x sin(2π(k+o)/p)+b*

>>Simulink library>>Simulink>>Sources>>Sine function

**Pulse generator:**

This block generates square wave pulses at regular intervals. The different block waveform parameters determine the shape of the output waveform. Two modes are present in Pulse generator block. They are time-based mode and sample based mode. In the time-based mode, the block computes the output only at times when the output changes thus resulting in fewer calculations. Whereas, in the sampled based mode the block calculates the output only at specific time intervals defined by the user.

>>Simulink library>>Simulink>>Sources>>Pulse Generator

The image below shows a model built in Simulink. There are three different sources generating signals which are then connected to scope to display the results.

**Operations on signals in Simulink:**

Similar to numerical operations, all the mathematical operations are performed on signals. For Example, if we have to implement the following function in Simulink.

*Y(t)=5*(sin(t)+sin(5t))-5*

This is a model built in Simulink to find the signal *Y(t)* as expressed in the equation above.

#### Model:

We add two different sine waves and their sum is then amplified by a factor of 5. Finally, five is subtracted from the result. To build a model to implement this function in Simulink we need two sine waves thus, we use two sine wave function blocks for the same. As per the function equation, we set the frequency of one wave as one unit and the other to be five times of the frequency of the first sine wave. In order to add these signals, we use an ADD block from the Simulink library which performs an addition operation.

Furthermore, the addition is then amplified by the factor of 5, to build that in out model we use a GAIN block from the Simulink library, assign the numerical value for the gain and connect it to the output of the adder. Furthermore, a SUBTRACT block subtracts 5 from amplified signal. The first input of Subtract block is the output of gain. The second input to Subtract block is A Constant block. A Scope block is used to view the output of the function just built. Once the whole model is built we simulate it for a specific period of time and observe the results in Scope as shown below.

### Leave a Comment

##### Vrushali Athawale

She completed her graduation in Electronics and Telecommunication from MIT Academy of Engineering, Pune. She has recently associated herself with MATLAB Helper and enjoys providing help in MATLAB and Simulink. She has a keen interest in astronomy and always finds time to keep that part of her alive.

### Recommended Posts

##### Fun Examples with GUI | MATLAB Tutorial

20 Oct 2017 - GUI Building, Tutorial