Laboratory work #1 Common Nonlinearity at Matlab Simulink 1.

Saturation

Here in this block diagram we have 4 components: sinewave as a source, nonlinear element saturation, a scope, which displays signals, and a XY Graph. Scope has two inputs for an input sinewave signal and for output saturated sinewave signal. That is why we have two graphs in the scope. As the limits of the saturation device are -0.5 and 0.5, the graph of sinewave becomes cut form the lower and upper bounds, so all values that exceed the limits will be of the values of a lower or upper bound. The XY Graph block displays an X-Y plot of its input & output relations in a MATLAB figure window. The block has two scalar inputs. The block plots data in the input (the x direction) against data in the output (the y direction), as you can see on the plot of XY Graph. 2. Dead Zone

In this task we again have 4 elements: sinewave, dead zone, scope and XY Graph. As in the previous example, we have an input signal – a sinewave, which is further modified by an element Dead Zone. Then the original signal and modified both go to the mux and to XY Graph. The Dead Zone block generates zero output within a specified region, called its dead zone. We need to specify the lower limit (-0.5) and upper limit (0.5) of the dead zone as the Start of dead zone and End of dead zone parameters. The block output depends also on the input values. While input value is within the lower and upper bounds, the output will be zero – dead zone. When input is bigger that upper bound, the output is input minus upper bound. The same situation with the lower bound: if input value is less that lower limit, output is input minus lower bound. The result is shown on the graph of a scope. The Mux block combines its inputs into a single vector output. An input can be a scalar or vector signal. All inputs must be of the same data type and numeric type. That is why mux has one output that is connected to a scope and the scope contains combination of original signal and the signal with the dead zone. The XY Graph plots the relation of the first input (the x direction) against data in the second input (the y direction). 3. Relay

This block diagram differs from the previous only by the absence of a dead zone. Instead of it we have a new component, called a relay. The Relay block allows its output to switch between two specified values. When the relay is on, it remains on until the input drops below the value of the Switch off point parameter. When the relay is off, it remains off until the input exceeds the value of the Switch on point parameter. The block accepts one input and generates one output. The Switch on point value must be greater than or equal to the Switch off point. Specifying a Switch on point value greater than the Switch off point models hysteresis, whereas specifying equal values models a switch with a threshold at that value.

5. Quantizer

Here we have a sinewave signal that passes through a quantizer and goes to a mux. Another signal that enters a mux is original sinewave. The combination of these signals goes to a scope. The graph shows us a sinewave with amplitude equal to 1, and a quantized sinewave with the same amplitude. The Quantizer block passes its input signal through a stair-step function so that many neighboring points on the input axis are mapped to one point on the output axis. The effect is to quantize a smooth signal into a stair-step output. The output is computed using the round-to-nearest method, which produces an output that is symmetric about zero. y = q * round(u/q) where y is the output, u the input, and q the Quantization interval parameter. Quantization interval The interval around which the output is quantized. Permissible output values for the Quantizer block are n*q, where n is an integer and q the Quantization interval. The default is 0.5. 6. Coulomb and Viscous Friction

The Coulomb and Viscous Friction block models Coulomb (static) and viscous (dynamic) friction. The block models a discontinuity at zero and a linear gain otherwise. The block implementation is y = sign(x) * (Gain * abs(x) + Offset)

where y is the output, x is the input, and Gain and Offset are block parameters. The Offset corresponds to Coulomb friction. By default, the Offset is a vector with four elements: [1 3 2 0]. This default vector tests the same input value against four different offset values. We can specify a vector with a different number of elements, such as one. The Gain corresponds to the signal gain for nonzero input values. By default, the Gain is 1. The block accepts one input and generates one output. The input can be a scalar, vector, or matrix. For a vector or matrix input, the Offset and Gain must have the same dimensions as the input or be scalars. For a scalar input, the output will be a scalar, vector, or matrix based on the dimensions of the Offset and Gain. For example, passing a scalar input to the block when using the default Offset produces an output vector with four elements. 7. Backlash

The Backlash block implements a system in which a change in input causes an equal change in output. However, when the input changes direction, an initial change in input has no effect on the output. The amount of side-to-side play in the system is referred to as the deadband. The deadband is centered about the output. This figure shows the block's initial state, with the default deadband width of 1 and initial output of 0.The Ramp block generates a signal that starts at a specified time and value and changes by a specified rate. The block's Slope, Start time, and Initial output parameters determine the characteristics of the output signal. All must have the same dimensions after scalar expansion. Slope Specifies the rate of change of the generated signal. The default is 1. Start time Specifies the time at which the block begins generating the signal. The default is 0. Initial output Specifies the initial value of the output signal. The default is 0. By default, the Product block outputs the result of multiplying two inputs: two scalars, a scalar and a nonscalar, or two nonscalars that have the same dimensions. The default parameter values that specify this behavior are:
 

Multiplication: Element-wise(.*) Number of inputs: 2

The signal at the output will be equal to the specified value, till the input signal while increasing does not reach significance (Deaband width) / 2 (where U - the input signal), then the output will be equal to U-(Deaband width) / 2. If direction of change of the input signal is changed, it will remain unchanged until the input signal does not change the value (Deaband width) / 2, then the output will be equal to U + (Deaband width) / 2. 8. Switch

The purpose of a switch is to switches between the input signals using a control signal. The block works in the following way: If the control signal applied to the middle input is larger than the threshold value, then the output of the signal passes from the first (upper) input. If the control signal will be less than the threshold value, then the output of the signal will come from the second (lower) input. In the case where the signal to the control input key is 1,the output unit is a harmonic signal, if the control signal is zero, then the output signal passes the zero level of the block Ground. The threshold value of the control signal is set to 0.5. 9. Multiport Switch

The multiport switch is used for switching the input signals using a control signal which sets the number of active input port. The block of Multiport Switch, transmits the output signal from the input

port whose number is equal to the current value of the control signal. If the control signal is not an integer, then the block produces a Multiport Switch discarding the fractional part of number, while in the Matlab command window shows a warning message. The control signal switch has three levels and is formed by blocks Constant, Step, Step1, and Sum. The output of Multiport Switch is harmonic signals with different frequencies depending on the level of the input signal. On the second picture we have a Multiport Switch block in which a number of inputs is set to 1. In this case, as the input we have a vector signal, and the block will skip to the output vector of the element whose number is the same as the control signal.

10. Manual Switch

The manual switch switches between the input signals to the user's command. To use a switch we need to double-click the left button of "mouse" in the image block. The image block is changed to indicate which input is currently goes to the output of the block.