78
Introduction to the use of MATLAB® (Communications and Signal processing) Dr.Wührl, Tibor Created by XMLmind XSL-FO Converter.

  · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Introduction to the use of MATLAB® (Communications and Signal

processing)Dr.Wührl, Tibor

Created by XMLmind XSL-FO Converter.

Page 2:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Introduction to the use of MATLAB® (Communications and Signal processing)Dr.Wührl, TiborDr. Schuster, György

A projekt az Új Széchenyi terv keretében a TÁMOP-4.1.2.A/1-11/1-2011-0041 „Audio-vizuális v-learning és e-learning tananyag- és képzésfejlesztés az Óbudai Egyetem Kandó Kálmán Villamosmérnöki Karán” támogatásával valósult meg.

Publication date 2014Szerzői jog © 2014 Panem Könyvkiadó Kft., Budapest

A kiadásért felel a Panem Kft. ügyvezetője, Budapest, 2011

Minden jog fenntartva. Jelen könyvet, illetve annak részeit tilos reprodukálni, adatrögzítő rendszerben tárolni, bármilyen formában vagy eszközzel - elektronikus úton vagy más módon - közölni a kiadók engedélye nélkül

Created by XMLmind XSL-FO Converter.

Page 3:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

TartalomPreliminary ........................................................................................................................................... 61. Let’s start simply! ............................................................................................................................. 12. Representation of numbers ............................................................................................................... 53. Vectors and matrixes ........................................................................................................................ 94. Functions and graphical possibilities ............................................................................................. 145. Cycles and conditional branching .................................................................................................. 246. Network characteristics functions and their analysis ..................................................................... 267. Time domain analysis of digital signal processing circuit without the use of special built-in MATLAB® function .............................................................................................................................................. 368. The communication tools ............................................................................................................... 46

1. Generate a random binary data stream ................................................................................. 462. Make 4-tuples of binary data stream .................................................................................... 463. Modulate using 16QAM ....................................................................................................... 474. Pass trough at AWGN channel ............................................................................................. 485. Demodulate the 16QAM ...................................................................................................... 506. Convert the integer-valued stream to binary data stream ..................................................... 507. Compute the BER (Bit Error Ratio) ..................................................................................... 508. Show the symbol mapping ................................................................................................... 529. Gray Coding solutions .......................................................................................................... 5410. Pulse shaping ...................................................................................................................... 5611. Eye-diagram ....................................................................................................................... 5812. Communication channel models ........................................................................................ 59

Irodalomjegyzék ................................................................................................................................ 62

Created by XMLmind XSL-FO Converter.

Page 4:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Az ábrák listája1.1. MATLAB® initial screen ............................................................................................................... 11.2. MATLAB® Editor ........................................................................................................................ 31.3. Executable „m” file ....................................................................................................................... 32.1. z = x + iy complex number ........................................................................................................... 64.1. Sine function ............................................................................................................................... 144.2. Sine function with bespangle ...................................................................................................... 154.3. Picture stored as a file without formatting .................................................................................. 164.4. Turned on „plot-tools” ................................................................................................................ 174.5. Displaying the sine and cosine functions in a single coordinate system .................................... 184.7. Displaying the function name with the „legend” function ......................................................... 194.8. Displaying more than one function with subplot ........................................................................ 194.9. Displaying functions with different amplitudes in a single coordinate system .......................... 204.10. Displaying functions with different amplitudes in a single coordinate system with different y axis scaling ................................................................................................................................................ 214.11. Three-dimensional function display with plot3 function .......................................................... 226.1. Two-gate modell ......................................................................................................................... 266.1. The amplification and phase course of the low-pass member in the function of frequency ...... 276.2. The amplification and phase course of the passing lane of the low-pass member in the function of frequency ........................................................................................................................................... 286.3. The pole-zero image of the (6.1.) transfer function .................................................................... 296.4. Nyquist diagram of the (6.1.) transfer function .......................................................................... 306.5. Nyquist diagram of the (6.1.) transfer function with the display of two frequency values ........ 306.6. Nichols diagram of the (6.1.) transfer function .......................................................................... 316.7. Bode diagram of the (6.1.) transfer function with the MATLAB® „margin” function .............. 326.8. The impulse response of the network described with the (6.1.) transfer response (weight function) ............................................................................................................................................................ 336.9. The step response (the transfer response) of the network described with (6.1.) transfer function 347.1. Modulo overflow characteristics ................................................................................................ 367.2. Flooding overflow characteristics ............................................................................................... 377.3. Triangle overflow characteristic ................................................................................................. 377.4. Second degree basic member (IIR filter) .................................................................................... 377.5. Simulated IIR filter ..................................................................................................................... 397.6. The transfer characteristics of the low-pass wave-digital filter in the function of frequency (FFT 512 absolute value) ................................................................................................................................... 437.7. Weight function of the low-pass wave-digital filter .................................................................... 447.8. The enlargement of the ringing off part of the weight function of the low-pass wave-digital filter 458.1. The stem plot of random binary data stream .............................................................................. 468.2. Scatter plot of 16QAM previous five symbols ........................................................................... 488.3. All symbols in 16QAM ............................................................................................................... 488.4. 16QAM loaded with random noise ............................................................................................. 498.5. 16QAM loaded with random noise (SNR=8dB) ........................................................................ 518.6. 16QAM symbols ......................................................................................................................... 528.7. 256QAM symbols ....................................................................................................................... 538.8. 16QAM binary coded symbols ................................................................................................... 538.9. 16QAM binary coded symbols ................................................................................................... 568.10. Impulse response of raised cosine filter .................................................................................... 578.11. Frequency response of raised cosine filter ................................................................................ 578.11. Eye-diagram of modulated signal ............................................................................................. 58

Created by XMLmind XSL-FO Converter.

Page 5:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Introduction to the use of MATLAB® (Communications

and Signal processing)8.12. Gaussian noise loaded signal .................................................................................................... 60

Created by XMLmind XSL-FO Converter.

Page 6:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

PreliminaryDear Reader!

Before we start working, let’s discuss exatly what is the MATLAB®!

Naturally, it is a suite which was made by MathWorks, Inc. and is constantly under development. The name MATLAB® originates from MATrix LABoratory.

For what good is this?

The MATLAB® is a mathematical suite, which was firstly developed for engineers, but nowadays, it is employed with great succes in biology, economic calculations. The present lecture note primarily wishes to discuss the MATLAB® in the electrical engineer approach. The presentation of use examples and practical exercises firstly focus on solving the communications and signal processing problems. The MATLAB® executable on UNIX® and MS-WINDOWS® platforms. The work is aided in every case by the finely contrived „HELP”. The introduced sample examples in the „HELP” and „DEMO” helps to recognize the additional applications and functions. We can get useful and up to date contents on the www.mathworks.com WEB page. Registered users can participate on WEB seminars, the so-called „WEBINAR”, which helps to keep your knowledge always up to date in a certain subject.

In the present lecture note my purpose is to simply and clearly introduce the use of MATLAB ®, therefore the Dear Reader may encounter simple examples in each chapter.

I would like to say thank you to Professional reviewer to Timót Hidvégi PhD and I’m grateful to László Berki, one of my students, for language support.

I wish for a successful and constant work!

The author

Created by XMLmind XSL-FO Converter.

Page 7:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

1. fejezet - Let’s start simply!Start the MATLAB® with the execution of matlab.exe or clicking on the MATLAB® icon. Then we can calmly „throw away” the paper, pen and calculator because henceforth our computing tasks can be carried out in the working environment more easily.

After the start of the program we can see this (or something similar) on the monitor:

1.1. ábra - MATLAB® initial screen

In the top rows are the usual menu of functions and icons which enable quick access to a series of shows. The screen area below the icon row is, by default, divided into three parts „Current Directory”, „Command Window” and „Command History”.

The Command Window allows the direct entering of MATLAB® commands. The commands are written after the >> prompt signal, every command row is closed by hitting the ENTER key. The previously entered commands in the Command Window can be retrieved and re-run from Command History window. In the event that you, Dear Reader, would delight in the capabilities of MATLAB®, click on the „demos” in the command window, but I would suggest that you make it later, when you are pleasantly weary and want to relax.

Now, consider the following simple task and its solution!

(1.1.. egyenlet)

How is it possible to solve all this with MATLAB®? Simply! Write the following in the Command Window, then hit ENTER!

Created by XMLmind XSL-FO Converter.

Page 8:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Let’s start simply!

(1.2.. egyenlet)

In response we got „ans = 3” which is consistent with the expected results.

In the following example let’s stay with the previously used (1.1.) equality, but now complicate the situation and formulate our task more generally, such as the:

(1.3.. egyenlet)

expression!

In this case, we need to declare that „a” and „b” are constant (obviously later they can be variables). This sounds complicated right now, but let’s watch how simple it is!

(1.4.. egyenlet)

The line was closed by the semicolon character (followed by ENTER of course - but that is not shown), in which case the current value is stored in MATLAB, but the screen does not display that. Without the semicolon character we get the following:

(1.5.. egyenlet)

With the (1.4.) expression we declared the value of "a" and "b", with which we are now free to perform mathematical operations. We can write after the >> promt signal:

(1.6.. egyenlet)

Okay! But now where is the result? Because of the semicolon character it doesn’t show up. In many cases it is useful, and makes the visibility easier, if the sub-results are not shown. Of course our „c” variable got the correct value, which are calculated using the (1.6.) equation, but is now only stored in the computer memory, the screen will not display it. The stored results, partial results naturally can be queried, displayed at any time. Then simply we write after the >> promt the variable name, and then press ENTER, for example:

(1.7.. egyenlet)

We don’t always remember the name of constants and variables, and partial results stored in the computer memory. The MATLAB® gives the „who” command possibility to display the declared variables:

(1.8.. egyenlet)

The names of the retrieved variables shown in alphabetical order, are: „a”, „ans”, „b” and „c”.

The current value of each variable can be displayed according to (1.7.). The „ans” variable is created when we calculated an outcome (partial result), which was not previously declared in variables (1.2.).

The computational algorithm should be stored as a file when performing complex computational problems. The computational tasks container files usually get the „m” extension. These files can be run directly from the command window. Let's stay with our simple example we discussed above, but before we get to it, delete from memory the variables we declared so far! We can do it by using the „clear” command and hit ENTER. Now we won’t get an answer if we use the previously introduced „who” command, so no variable is declared valid.

Created by XMLmind XSL-FO Converter.

Page 9:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Let’s start simply!

Now, that our MATLABis getting a fresh start, select File menu, point to New, and within the M-file. Then the MATLAB calls forth the screen editor. The newly opened document is called „Untitled”.

1.2. ábra - MATLAB® Editor

Let’s make an „m” file with the editor program and give it the name osszeg.m . To save the file (with a name) choose from the File menu the Save as point. The written program is as follows:

1.3. ábra - Executable „m” file

The Editor program automatically gives a serial number to the rows. If the row is executable, after the serial number comes the „-” sign. We can write our comments in the edited program. After the percent (%) character every written character is stored as a comment.

Created by XMLmind XSL-FO Converter.

Page 10:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Let’s start simply!

To run an „m” file we have multiple possibilities, from which the easiest is to write the name of the file in the command row, then hit ENTER. Then we only need to pay attention so the edited „m” file is in the folder or in the directory in the MATLAB® path. The executing is doable directly from the Editor program by choosing the Run point of the Debug menu

(F5 – function key or clicking on the Run ikon).

Of course, the input variables have to be declared before the run, otherwise we get the following error message:

(1.9.). egyenlet)

After correctly declaring the variables (for example (1.4.)), the „m” file is successfully runable.

Now we can calmly lie back in our armchair, because we were introduced to the MATLAB and we can use it too! It is true that we still need to practice using it, to develop our skil level, and it is advisable to get to know some of the functions and the individual themes and fields of science available „tool-kit”, the so-called „tool-box”. So in the coming chapters we will firstly solve the kind of arithmetical examples, which helps us achieve the above mentioned objective.

Dear Reader! If you are pleasantly weary I suggest to run the MATLAB® demo as a means to rest and relax (click on the „demos” point in the command window, which is found on the top of the page, or write the „demos” word after the >> prompt, then hit ENTER).

Created by XMLmind XSL-FO Converter.

Page 11:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

2. fejezet - Representation of numbersIn the previous chapter our objective was to be introduced to MATLAB, so we used real whole numbers to work with. Naturally the MATLAB® is able to do more! We were already introduced to the display and declaration of whole numbers. The fractions can be given in decimal form. The whole part and the fractional part are separated by a decimal point, which looks like this:

(2.1.. egyenlet)

The fractions can be given in the form of compound fractions with the decralation of the numerator/denominator, for example:

(2.2.. egyenlet)

The data storage is done in decimal form which is also identical to the previous one.

The display format can be given with the command of „format + parameter”

In the above mentioned examples (2.1.) (2.2.) the „format short” option was valid. It makes the representation of numbers and visualization more accurate, if we switch it to „format long”.

After we switched to „format long” let’s get π-s value. {The π is a constant, which is defined in advance, and which can be referred to as „pi”.}

(2.3.. egyenlet)

The presentation is 14 decimal place.

The formats are listed only at the following levels:

Command: Meaning:

format short Displays 4 decimals

format long Displays 14 decimals

format shotr e Displays in floating point form 4 decimals, For example: 1.2345e+002

If the exponent is 0, then it displays 000.

format short g Displays in floating point form 4 decimals, For example: 1.2345e+002

If the exponent is 0, then it won’t display

Created by XMLmind XSL-FO Converter.

Page 12:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Representation of numbers

the exponential part.

format long e Displays in floating point form 14 decimals, For example: 1.23454455667788e+002

If the exponent is 0, then it displays 000.

format long g Displays in floating point form 14 decimals, For example: 1.23454455667788e+002

If the exponent is 0, then it won’t display the exponential part.

format bank Displays 2 decimals

format rat Displays in ordinary fraction form. The numerator and denominator are separated by the / sign.

format hex Displays in hexadecimal form.

format compact When displayed, it leaves out every empty line.

The propertise of the listed and usable formats can be retreived by the „help format” command.

When solving technical tasks, often there is a need to illustrate the complex number and the operation is performed with complex numbers. Complex numbers are easily declares in MATLAB. Before we look at the declaration of complex numbers and the operations can be performed with them, let’s have a look at the complex numbers and their meanings as a repetition.

The complex numbers are composed of real and imaginary parts. We make up the imaginary part with the „j” or the „i” operator (MATLAB® accepts either, but converts the „j” to „i”). From now on I am going to indicate the complex operator with „i”, which is none other than the root of -1, that is i 2= -1. {Karl Gauss called the „j” the „shadow of shadows”}

So the complex number is composed of two members, the real and imaginary parts:

(2.4.). egyenlet)

The „z” complex number can be illustrated in right-angled coordinate system. Then we can choose for example the horizontal axis as the real axis and the vertical as the imaginary:

2.1. ábra - z = x + iy complex number

Created by XMLmind XSL-FO Converter.

Page 13:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Representation of numbers

The complex number, seen on the 2.1 Figure, can be marked by the vector, which points to it from the origo. The vector can be given by the real axis and the degree {Φ}, which is closed by it and the vector and by the lenght {M} of the vector.

In view of the parameters the complex number can be given in the following form, with the so-called polar formula:

(2.5.. egyenlet)

The length of the vector „M”, where:

(2.6.. egyenlet)

relationship can be calculated, and the state of the vector:

(2.7.. egyenlet)

relationship can be given. The relationships are easy to see with the help of the 2.1 Figure.

The complex number is often given in trigonometrical form:

(2.8.. egyenlet)

Now that we repeated the illustration mode of the complex numbers, let’s define two complex numbers in the following:

(2.9.. egyenlet)

Created by XMLmind XSL-FO Converter.

Page 14:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Representation of numbers

Ask for the „b” number in the usual way! Then we get the following result:

(2.10.. egyenlet)

Now we add the 2 complex numbers. For the addition we can use the „m” file (1.3 Figure), which was mentioned in the former chapter. The result then is stored in the „c” variable:

(2.11.. egyenlet)

From above, we can see that the operations are done in the same way with the complex numbers (selected in the MATLAB®), as in the case of the real numbers. In view of the algebric form of the complex number the polar or the trigonometric form can be determined with the known relationships (2.6) (2.7), the makes our life easier with auxiliary functions. The absolute value of the complex number can be calculated by the „abs”, the angle by the „angle” function. The result of the „angle” function is given in radian in the range of ±π. As an example let’s calculate the absolute value and the angle of the former complex result:

(2.12.. egyenlet)

Of course, the previous calculations can be done, when the received results are stored in declared variables, same as we did in the (1.6) example.

When declaring a variable we need to summarize the following:

• We don’t need to know and give the type of a variable in advance.

• When declaring the variable we should avoid the charecters which are already declared in MATLAB®, for example: i, j, pi and the special characters.

• Operators and accentuated letters can’t be used in the variables name.

• To declare variables we can use a string of multiple characters (the maximum character a declared variable can use is 31), these can also be names.

• The MATLAB® distinguishes between upper and lowercase letters, thus declared an "A" variable is not equal to the variable "a".

Created by XMLmind XSL-FO Converter.

Page 15:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

3. fejezet - Vectors and matrixesIn the previous chapter we reviewed the real and the imaginary representation of numbers. The scalar numbers can be arranged in vectors, matrixes, what’s more the scalar numbers can even be conceptualized as a 1x1 matrix, and a vector of n elements too, such as a matrix of size nx1 or 1xn.

When we define the matrix and the vector, the matrix elements have to be separated by commas, and to separate the rows from each other we have to use the semicolon sign. Between two elements elements of a matrix a space character should be inserted. The elements have to be written in square brackets [].

In the matrix defining example we are going to use the so-called Dürer magical matrix. This matrix can be found on a renaissance copper engraving (Melencolia I, found by Albert Dürer).

Now we define this matrix in the MATLAB, let’s name this matrix with A!

(3.1.. egyenlet)

Now ask for the A value in the usual way!

(3.2.. egyenlet)

Henceforth we are using this matrix to show you some simple operations. During the performing of the operation we are going to find out why is this matrix called magical.

Add the components of the matrix columns. With a matrix of this size we can do this just by looking at it, this isn’t more complicated than the (1.1.) exercise.

(3.3.. egyenlet)

We can see that the sum of every columns elements are 34.

Now let’s add the elements of the rows!

(3.4.. egyenlet)

When we made up the amount we used a little trick, namely we made up the transpose of the Dürer matrix (in other words we swapped the columns and rows of the matrix, we made up matrix rows from the columns and columns from the rows). The transposition was the ’ operator. The resulting transposed elements of the matrix columns were summed and the resulting row vector is transposed, so we got a four-element column vector. The transpose of the A matrix is like this:

Created by XMLmind XSL-FO Converter.

Page 16:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Vectors and matrixes

(3.5.. egyenlet)

Now let’s see the next operation, take out the elements of the main diagonal into a vector! This can be done by the „diag” function:

(3.6.. egyenlet)

The result of the take out of the main diagonal is a column vector. If we look at the column vector, it’s immediately noticable, that the sum of the column vector elements is 34. Now let’s check with the MATLAB®, if it is true:

(3.7.. egyenlet)

Indeed! The result is as we expected, in other words we add the elements of the main diagonal of the magical Dürer matrix, then we get the same number as the sum of the vector elements made up of the matrix rows and as the sum of the column elements too. Of course, in the (3.7.) operation the greatest joy isn’t caused by the result (34), but the fact that some of the functions can be nested! The MATLAB® therefore offers the possibility of individual functions inside each other, so complicated mathematical expressions can be created without the need for an intermediate variable to store some partial results.

Naturally, there are cases where the partial result can give us useful information (like troubleshooting), then for these partial results a variable has to be declared (practical).

In the former examples we learned how to declare a matrix, give it elements and tried out some matrix manipulation operation. Matrixes have a true technical meaning, if for example with its help we can solve systems of equation. For this the above used operations are not sufficient.

From now on we are going to look over some other useful operation.

During the calculations a matrix is often needed, or to take out a vector element. For example, we want to continue our calculations with a given element, like with a scalar quantity.

In our example this element take out is going to be the second rows third columns element of the Dürer matrix. For this we do the following:

(3.8.. egyenlet)

The the element of second row and third column of A matrix is put in the „element23” variable.

In linear algebra the matrix determinant calculation has a big signification. In the case of a 4x4 matrix we have a good chance to determinate the value of the determinant, but it is also a time-consuming task, if we do the calculation on paper with a pencil. The manual counting is error-fraught, for large matrixes, it is almost impossible to solve the task on paper.

Created by XMLmind XSL-FO Converter.

Page 17:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Vectors and matrixes

I encouraged the Dear Reader at the very beginning of the first chapter to throw away the paper and pencil! Now I do the same! At the same time we mustn’t forget that the computer is only a replacement for the paper and pencil, the computer doesn’t think instead of us, so we always have to know exactly what are the rules for carrying out the operations.

Calculate the determinant of the A matrix with the „det” function:

(3.9.. egyenlet)

So the Dürer matrix is singular, the determinants value is zero.

From our mathematical knowledge, if we remember, we know that the singular matrix doesn’t have an inverz. Let’s try calculate the inverz of the A matrix (3.2.). Use the „inv” function:

(3.10.. egyenlet)

We didn’t really get the expected result, or did we? We need to know that the computer's representation of numbers accuracy is limited, so in many cases the approximate result is given. All members of the resulting matrix be multiplied by 1015, that is the obtained matrix is composed of unrealistically high value components. This can be traced back to that because of rounding causes instead of dividing with zero the division occured with some small number (close to zero). The warning message (Warning) signals for us that the obtained result is not completely okay. In any case, such messages should be taken into account when we asses the result!

From now on we aren’t going to be using the magical Dürer matrix to help us understand the following operations. Let’s look at a simple, practical exercise (again our objective wasn’t to choose a complicated problem, but for the calculations be transparent and verifiable):

Solve the

(3.11.. egyenlet)

system of equations!

The system of equations can be written in matrix forms:

3.12

From the matrix form we can see that we can get the the value of x and y vector components, if we multiply the inverz of the matrix, which was created with the 5, 3, 10, -2 elements, with the column vector, which elements are 57 and 42.

Created by XMLmind XSL-FO Converter.

Page 18:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Vectors and matrixes

In the MATLAB® this exercise is easily solved:

(3.13.. egyenlet)

The solution is the c column vectors elements, in other words x = 6 and y = 9.

If we substitute it in the original equation (3.11.), we can see that our solution is correct.

So in the example above we saw the effective solving of a linear system of equations. This method can be efficiently used in the analysis of linear circuits.

In the example (3.13.) above we multiplied a matrix with a column vector. Interpretable operation furthermore is the addition and subtraction of the matrix too, then the used operators generally are „+” or „-”. It may also happen that the operations have to be performed for each element. The referring to the elements of the matrix, or vector, was already seen previously (3.8.), but the method there firstly made it possible to take out one element, so using that here would make the exercise rather complicated. To carry out element-by-element operations the MATLAB® uses specifically defined operators, which are:

Operator: Meaning

.*

(decimal point and asterisk)

Matrix or vector element-by-element multiplication

. /

(decimal point and slash)

Matrix or vector element-by-element division

. ^

(decimal point and up-arrow)

Matrix or vector element-by-element exponentiation

Examine the operation of the multiplication and the element-by-element multiplication. For our examinations difine one row and one column vector. Both vectors have 5 – 5 elements. The row vector is called „rvector”, the column vector „cvector”:

Created by XMLmind XSL-FO Converter.

Page 19:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Vectors and matrixes

(3.14.). egyenlet)

Let’s multiply the two vectors!

(3.15.). egyenlet)

The vectorial product gave a scalar number, which is the sum of the product of the same index number of the row and column elements. The basic condition of the vector multiplication was that the row vector and column vector have the same number of elements.

Element-by-element multiplication can be done only between the same types of vectors, that is between two row vector or column vectors of the same number of elements can be interpreted. From the formerly defined (3.14.) vectors, to do element-by-element multiplication, one vector has to be converted (that is transposed):

(3.16.). egyenlet)

During the operation above (3.16.) we changed the column vector into a row vector, so the element-by-element multiplication can be done between two row vectors of the same number of elements. The result is a row vector with five elements. Of course, the element-by-element multiplication can be done, when we can change the row vector into a column vector:

(3.17.). egyenlet)

The result now is a column vector with 5 elements. Each value of the elements with the same index number are the same as in the (3.16.).

The element-by-element operation between matrixes is interpreted the same way, but do not forget, that only between matrixes of the same dimension!

I hope the Dear Reader is pleasantly tired no, but now I suggest that you DO NOT start the demo, instead for relaxation you should begin the processing of the next chapter. I promise that the coming chapter will be much more exciting and of course spectacular, because we are going to „stir” the graphical possibilities of the MATLAB®. Instead of the boring numbers now we can admire the colorful illustrations.

Created by XMLmind XSL-FO Converter.

Page 20:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

4. fejezet - Functions and graphical possibilitiesLet’s quickly define a ’fi’ vector, in which the elements run in the interval from 0 to 2π with 0.05 step value! But, it’s not what we agreed on at the end of the previous chapter… Patience, we’re going to draw immediately!

The vector we wish to define is composed of more than a hundred elements. The producing manually of this vector, this is a time-consuming task and presents a lot of room for errors. To define the vector we are going to use a different method:

(4.1.. egyenlet)

The elements of the vector we defined this way aren’t going to be listed, because the fi vector is composed of more than 100 elements (exactly 126.). The value of the elements are:

0 0.0500 0.1000 .... 6.2500

Let’s imagine the elements of the fi vector, as if they are the time-varying angles of a unit vector. Calculate the projection of the vector. For the calculation we use either of the sine function, the result is also stored in a vector!

(4.2.. egyenlet)

We can list the vector elements the usual way, but we aren’t going to do it now again (naturally the Dear Reader can do it as an experiment), because this vector has the same number of elements as the fi vector. Of course, it is the possibility of the vector elements show in graphical display. Give the following command in the MATLAB® command window:

(4.3.. egyenlet)

The following window is displayed:

4.1. ábra - Sine function

Created by XMLmind XSL-FO Converter.

Page 21:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Functions and graphical possibilities

The display range is automatically selected in the MATLAB®, at the selection of the range it adjusted the range to the functions domain and range. Our Figure above is expressive, but at the same time quite „bald”. Let’s bespangle it out a bit!

(4.4.. egyenlet)

The „dressed” Figure (4.2 Figure) is now easier to understand. The „grid” command gives our Figure a „raster” net, which helps us read the values. With the „title” function we can give a name to our Figure, while the „xlabel” and the „ylabel” functions make it possible to name the x and y axes.

4.2. ábra - Sine function with bespangle

Created by XMLmind XSL-FO Converter.

Page 22:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Functions and graphical possibilities

On the graphical Figures (4.1 and 4.2) we can see menu points, which helps us make further editing. The often used menu points are displayed as ikons (saving Figure, print Figure, rotate Figure, zoom in-zoom out, datacursor on and off, „plot-tools” on and off). These menu points aren’t detailed in this lecture note, but we are going to look over some useful functions.

For making documents being able to store the Figures (without MATLAB® window and frame) directly in files is a useful function. The file format palette is fairly wide (bmp, jpg, pcx, pdf, and so on). The Figures stored in files can be edited with drawing program (like any other picture), it can be fitted into a document made by text editor.

Without formatting the 4.4 Figure picture, after storing it as a file, then inserting it into this document, it is like this:

4.3. ábra - Picture stored as a file without formatting

Created by XMLmind XSL-FO Converter.

Page 23:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Functions and graphical possibilities

After turning on the plot-tools we see the following on the screen:

4.4. ábra - Turned on „plot-tools”

After turning on the plot-tools (under the menu point, the last ikon on the right, in the ikon row) new windows are opened around our Figure. With the help of the „tool-kit” there is almost no limit to the prettifying of our Figure. As a useful possibility, it is worth mentioning the ikon which turns on- off the „data cursor” (in the ikon row from right to left the 5. ikon), which when clicked on, then pointing the cursor on some notable point of the function, the program is going to write in a text box the value of the x and y.

Created by XMLmind XSL-FO Converter.

Page 24:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Functions and graphical possibilities

The exercise often comes up, where you have to display more than one function. The MATLAB® gives more than one possibility for this. In the coming example produce a cosine function with using the previously used fi vector (4.1.).

(4.5.. egyenlet)

Display the sine function samples, which we formerly made (4.2.) and stored in the a vector, and the cosine function samples, which we created (4.5.) and stored in the b vector, in a single graph. To display it, we need to type in the previously introduced commands in the MATLAB® command window:

(4.6.. egyenlet)

In the Figure window the sine and cosine functions are displayed:

4.5. ábra - Displaying the sine and cosine functions in a single coordinate system

On the 4.5 Figure the a and the b vectors are displayed in a single coordinate system. After the execution of the (4.6.) command we sorted the picture in a file with the opening „Figure” windows „file” menu points „save as” point. While giving the file it’s name we can choose the type of the file too. The JPEG (jpg extension) gives a compressed format, but then the quality of our Figure will become lower, and in this case (contrasting Figure) the color information will be significantly damaged. In the case, when we choose the BMP (bitmap) format, then the formerly mentioned negatives (color and contrast quality deterioration) won’t come up, but then larger files are created.

The MATLAB®, for the curves of the functions displayed in a single diagram, will use different colors to make the distinctness easier. It should be mentioned here that the color displayed and the display mode is set by the user parameter. The parameters can be given with the „plot” function. On the 4.5 Figure it’s trivial, which curve belongs to which function, but it’s not always so simple, therefore we have the possibility of displaying on the

Created by XMLmind XSL-FO Converter.

Page 25:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Functions and graphical possibilities

Figure, which color was used for the first, the second and so on to the n-th function. This is the purpose of the „legend” MATLAB® function. When we are using the legend function we have to give the name of the function we want to display. Then a text box is going to appear on our Figure. The text box contains the „line” and color sample to display the function, and the inscription for each parameter. Between the plot and the legend function there is no connection, only between the order of the parameters. Write into the command window the following:

(4.7.. egyenlet)

After the execution of the command (4.7.) the before mentioned text box appears (see 4.7 Figure).

Remember back, when we displayed the sine and cosine functions (4.6.) the first parameter we gave to the plot function was the sine x and y parameters, so when we give parameters to the legend MATLAB® function (4.7.) dirstly we give it the ’sine’ parameters. In the case, when we swap the legend parameters, we would get an incorrect Figure!

4.7. ábra - Displaying the function name with the „legend” function

The demand often occurs to display our Figures in a way, when they aren’t projected on each other, but be next to each other (or on top of each other, or both). The MATLAB® also provides this option. Let’s see the next example!

(4.8.. egyenlet)

4.8. ábra - Displaying more than one function with subplot

Created by XMLmind XSL-FO Converter.

Page 26:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Functions and graphical possibilities

The subplot MATLAB® function provides an opportunity for us to display the functions at the same time, but in seperate coordinate systems. The subplot function needs three parameters. The first parameter is the number of parameters displayed next to each other, the second is the number of Figures displayed in a column. The third parameter is the serial number of the actual window (as sub-window), in which we display the Figure with the already well-known plot command. In the (4.8.) partial program we typed in more than one command in a row, each command is separated from the other with a semicolon, except the plot and subplot. These commands are now intrinsically linked together (subplot indicates the allocation and the actual drawing space, the plot carries out the displays), and are separated by commas.

The 4.8 Figure can be further prettied up just as we learned before (for example we can name the x and y axes, choose the color display, furthermore choose the display mode too).

We can run into a new problem, if we choose two functions to display in a single coordinate system, whose amplitude are significantly differ from each other.

Run the following program!

(4.9.. egyenlet)

Then the coming Figure is displayed:

4.9. ábra - Displaying functions with different amplitudes in a single coordinate system

Created by XMLmind XSL-FO Converter.

Page 27:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Functions and graphical possibilities

We can see on the 4.9 Figure that in the case of functions with significantly differing amplitudes, because of the automatic scaling of the y axis the signal with the smaller amplitude is barely seen. Of course, before displaying we have the opportunity of multiplying the function with a constant, but then we get an incorrectly scaled Figure. It is practical to mark this difference in the given inscription of the „legend” MATLAB® function.

The MATLAB® provides further opportunities to display signals with different amplitudes, since the y axis can be scaled two ways, if we use the plotyy function for displaying.

Run the following partial program (we assume that the vectors a and b, which we defined in (4.9) is still there.)

(4.10.. egyenlet)

The (4.10) execution result was obtained in the following Figure:

4.10. ábra - Displaying functions with different amplitudes in a single coordinate system with different y axis scaling

Created by XMLmind XSL-FO Converter.

Page 28:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Functions and graphical possibilities

The previously displayed Figures x and y axes was in linear division. In the engineering practice it is widespread to divide the axes into logarithmical steps (let’s think about the analysis of a signal in the frequency range, as well as the display of a network transfer function!).

In the case, when we wish to change the x axis to logarithmical division, when displaying a given function, then instead of the plot function we use the „semilogx” MATLAB® function to display. To make the y axis logarithmical we use the „semilogy”. If we need to scale both axes (x and y) logarithmically, then we use the „loglog” function. Giving parameters to the above listed functions can be done the same way, as the „plot” function.

In the case of multivariable functions we have expressive display (function drawing) opportunities, which are provided by the three-dimensional plot. Let’s also look at an example!

(4.11.. egyenlet)

And the result (I think it speaks for itself):

4.11. ábra - Three-dimensional function display with plot3 function

Created by XMLmind XSL-FO Converter.

Page 29:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Functions and graphical possibilities

I am not going to talk more about the plot3 MATLAB® function, the precise parameters can be listed by giving the command „help plot3”. The Dear Reader (of course, if you have the energy) can admire innumerable colorful, three-dimensional graphic by starting the MATLAB® demo, in this lecture note we aren’t giving you guidance for that. In the following we are going to look over – as the basically needed element of the MATLAB® source programming – the cycle organization, then we are going to solve exercises now only related to communications in the example tasks.

Created by XMLmind XSL-FO Converter.

Page 30:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

5. fejezet - Cycles and conditional branchingWith programs the need often arises to run a partial program – according to a certain number of cycles, or certain conditions have been met or have not been met – several times. To solve this kind of need we can organize the so-called cycle. For organizing cycles the MATLAB® gives us multiple opportunities.

„FOR” cycles

(5.1.. egyenlet)

In the above example (5.1.) we can see two cyles embedded into each other. The variable of the outer cycle is the „I”, which value runs between 1 and „N”. The variable of the inner cycle is „J”, which also takes up an increasing value between 1 and „N”. The core of the cycle is realized with a value giving order. Naturally, in the cycle core may be more serious, multiple command lines of program units. In case of N= 4 the result of the execution is the following:

(5.2.. egyenlet)

With the cycle defined in the (5.1.), in case where the value is N=4 with the value giving built in the cycle core A(I,J)= 1/(I+J-1); we created a 4x4 matrix. At the calculation of each element the actual I and J values are used too.

In the (5.1.) example we saw two cycles embedded into each other, but of course, several cycles can ce embedded into each other.

Conditional program gives opportunity to branches with the „IF” conditional branch instruction and the similar conditional control transfer instructions.

(5.3.. egyenlet)

The partial program above uses the results of the (5.2.) execution. Before the execution we have to give value to „I” and „J”. The partial program works as follows. If „I”-s value is the same as „J”-s, then the element of the A matrix (I,J) in the given index position changes to 2. If the absolute value of I-J is 1, then the element of the A matrix (I,J) becomes -1. In the case, when neither condition is met, then the value of the indexed element is 0.

The (5.3.) program in words can be described as follows:

Created by XMLmind XSL-FO Converter.

Page 31:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Cycles and conditional branching

If the I equals to J, then the element of the A matrix (I,J) is equal to 2;

However, if the absolute value of I-J is equal to 1, then the element of the A matrix is equal to -1;

Else (if neither of the two conditions are met), then the element of the A matrix is equal to 0.

The (5.3.) execution of the example with the I=4 and the J=4 starting condition gives the following results:

(5.4.. egyenlet)

Because in this case the I=J condition is met, thus the 4. row 4. column of the matrix gets the 2 value.

Of course, the MATLAB®-s cycle organization and conditional program branch opportunities

are much wider, than the above could meet. Further examples, explanations can be seen by typing in „help if”, or „help for” in the command window.

Created by XMLmind XSL-FO Converter.

Page 32:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

6. fejezet - Network characteristics functions and their analysisIn communications the circuits (filters, amplifiers) are often demonstrated as two-gate models. Generally, one gate is the input, while the other is the output. The description of the circuits, granting the electrical characteristics can be done in many ways (for example with impedance, admittance parameters and so on, but we do not deal with all this right now, Teacher Antal Schnöller is going to interrogate you about them anyway, so you can’t get away with it all permanently :-).

6.1. ábra - Two-gate modell

We can examine the circuits, their functioning, and describe them in the time and frequency range as well.

In case of time range examination the circuit impulse response clearly describes the functioning of the circuit. If we connect the dirac-delta function δ(t), learned on math class, to the input of the network, then the output response signal will be the so-called impulse response k(t). The impulse response function can be called the weight function too.

From the impulse response of the circuit we can deduce it’s stability. If the impulse response is withering away, that is in a finite time the output signal reaches zero and stays that way, then the network is stable. In case when the impulse response is up-festering, or oscillating on a fixed amplitude the circuit is unstable.

The impulse response has further, deeper meaning too. Let’s think through this (and remember the things you learned on arithmetic class!): The dirac-delta is a down and uprunning signal under an infinitely short time, where the area under the „curve” is one. Due to physical approach it is reasonable, that in a signal like this every frequency component is represented with the same amplitude, in other words the picture of the frequency range is a frequency-independent linear unit. So on the input, where the network is generated by the dirac-delta, we give the kind of signal, in which each frequency component was present. From this input signal chose (filtered) the circuit the output signal, which we call the impulse response in the time range.

Now let’s examine the meaning of the impulse response function in the frequency range!

Transform the function you got from the time range to the frequency range, with this we got a characteristics which describes the frequency transfer. The function which describes the frequency transfer is called the transfer function H(p) of the circuit.

In the complex frequency range (marked with „p” or sometimes marked with „s”) the transfer function can also be obtained, by making up the quotient of the Laplace transformation of the output signal and input signal.

After the short – and not too precise from every view – theoretical introduction, with the help of the MATLAB®, we are going to examine network characteristics functions, execute circuit analysis with their help. Let the transfer function of the network we wish to examine be this:

6.1

Created by XMLmind XSL-FO Converter.

Page 33:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Network characteristics functions and their analysis

To illustrate it with the Bode diagram the fraction of the transfer function has to be broken down into parts. After breaking them down into appropriate fraction parts (first and second degree parts) we can illustrate with breaking points the mitigation, amplification, and phase diagrams of the network in the function of frequency.

For this we must search for the given roots of the polynom (polynom of the numerator and the denominator), and this isn’t always an easy task. The Bode diagram described by the (6.1.) transfer function of the network can be displayed with MATLAB® the the following way:

(6.2.. egyenlet)

The p coefficients of the (6.1.) transfer function is defined in vector format, where we started to write the p coefficient with the highest degree number, ending with the coefficient of p0.

Naturally, if the value of the coefficient is 0, that doesn’t mean we can forget the zero!

For example, if the polynom is as follows:

(6.3.. egyenlet)

then the vector storing the polynom coefficients will look like this:

(6.4.. egyenlet)

In the (6.3.) expression the value of the p3 and the p0 coefficients are 0!

The (6.2.) execution result is the following:

6.1. ábra - The amplification and phase course of the low-pass member in the function of frequency

Created by XMLmind XSL-FO Converter.

Page 34:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Network characteristics functions and their analysis

On the 6.1 Figure we can see the amplification and the phase characteristics of the low-pass natured circuit in the function of frequency, given with the (6.1.) transfer function.

The scaling of the axes is done by the MATLAB® automatically. That is why it is quite hard to see the value of the mitigation of the low-pass range. Of course, there is a cure for this! The Bode function is parametered like this:

(6.5.. egyenlet)

where the value of the WMIN and the WMAX have to be given in rad/s.

Execute the following with the H(p) defined in the (6.2.) program part!

(6.6.. egyenlet)

In the curly brackets are the upper and lower limits of the frequency range to be displayed.

The execution result is this:

6.2. ábra - The amplification and phase course of the passing lane of the low-pass member in the function of frequency

Naturally, we can use the „plot-tools”, introduce in the chapter „Functions and graphical possibilities”, with the 6.1 and the 6.2 Figures, wich allows the Figures to be prettified and customized.

We are often interested in the pole-zero image of the transfer function. The pole-zero image of the (6.1.) transfer function, of course, can be given pretty easily, but in the case of polynomes with a hihger degree number this requires a lengthy calculation. The MATLAB® helps us again. As a built-in function we can find the „pzmap”, and the „roots”.

Created by XMLmind XSL-FO Converter.

Page 35:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Network characteristics functions and their analysis

(6.7.. egyenlet)

If we execute the (6.7.) program part, then the obtained result is this:

6.3. ábra - The pole-zero image of the (6.1.) transfer function

Naturally, we aren’t going to be surprised by the 6.3 Figure, because if we look at the (6.1.) function, we can see from a glance, that it doesn’t have a zero, what I mean is we aren’t going to find a finite frequency, when our numerator would become zero. The denominator is second degree, so we are waiting for two roots. In the present case a complex conjugated root is realizing the roots of a second degree equation (denominator). On the 6.3 Figure the MATLAB® uses an X to mark the poles on the complex plain.

We can get the numerical value of the denominator polynom roots, if we type in this:

(6.8.. egyenlet)

In the (6.8.) the denominator of the (6.1.) transfer function (H(p)) is declared „denom”. The roots of the polynom were given by the „roots” function of the MATLAB®.

The electrical circuit analysis and synthesis in practice often requires a different way of representation from the Bode diagram, and we won’t be satisfied with the pole-zero image of the transfer function either. The MATLAB® supports several kinds of display modes. From now on we are going to look over these. Any further example is also going to use the transfer function given (6.1.).

The Nyquist diagram of two-gate circuit given by the (6.1.) transfer function can be displayed as follows:

Created by XMLmind XSL-FO Converter.

Page 36:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Network characteristics functions and their analysis

(6.9.. egyenlet)

6.4. ábra - Nyquist diagram of the (6.1.) transfer function

On the 6.4 Figure both the positive and negative frequencies are shown. The direction of the „growth” of the frequency is indicated by the arrows painted on the diagram.

We can ask for the help of the „plot tools” again, what’s more for the correct interpretation of the present diagram it can’t be avoided, because on the displayed curve – which was described by the „peak” of our complex vector – the frequency isn’t parametered. On the next Figure we can see the precise display of each frequency:

6.5. ábra - Nyquist diagram of the (6.1.) transfer function with the display of two frequency values

Created by XMLmind XSL-FO Converter.

Page 37:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Network characteristics functions and their analysis

Further display mode is the Nichols method, where the amplification is displayed in the function of the phase. This examinations is usually done with the anlysis of feedback systems. The open system (broken feedback) phase and amplification reserve plays an important role in during the stability examinations.

To execute our examination run the following:

(6.10.. egyenlet)

6.6. ábra - Nichols diagram of the (6.1.) transfer function

Created by XMLmind XSL-FO Converter.

Page 38:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Network characteristics functions and their analysis

Of course, the data read from the Nichols and the Nyquist diagram is also found in the Bode diagram! Don’t forget that only the technic of the display differs. In several cases we only choose a different display technic, because certain circuit characteristics are more easily read from one diagram than the other.

To determine the phase and amplification reserve, the MATLAB® provides the „margin” function:

(6.11.. egyenlet)

6.7. ábra - Bode diagram of the (6.1.) transfer function with the MATLAB® „margin” function

Created by XMLmind XSL-FO Converter.

Page 39:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Network characteristics functions and their analysis

The „margin” MATLAB® function graphically displays the characteristics of the circuit with Bode diagram (like it did with the „bode” function), but it gives the numerical value of the amplification and phase reserve at the top of the Figure. The definition of the phase and amplification reserve plays a significant role during the analysis of the feedback systems. In the present case the value of both is infinite.

After the analysis in the frequency domain, examine the possibility of the analysis in the time domain. Like we reviewed during the introduction, from the analysises in the time domain the Dirac-delta excitation with examination signal is particularly important. The response of the network is the impulse response (also called weight function), where the transform of the Fourier gives the transfer function of the network. In reality we don’t have (in theory we wouldn’t have) any other task, other than to transform the results we got in the frequency domain into the time domain with the inverse Fourier transformation. In most cases it’s practical to do this, but in most cases because of the „window” problems it’s practical to do our calculations in the time domain too. The time domain analysis is unavoidable in cases with multiple-input circuits, where the superposition theorem is false (non-linear networks).

With the help of MATLAB® built-in functions we can easily display the impulse response of our circuit in linear, time invariant cases:

(6.12.. egyenlet)

6.8. ábra - The impulse response of the network described with the (6.1.) transfer response (weight function)

Created by XMLmind XSL-FO Converter.

Page 40:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Network characteristics functions and their analysis

The examination of the impulse response of a network can be interesting firstly from the view of stability. We are interested in that, will the impulse response ring off, won’t the ungenerated stay in the oscillating (constantly festering, or with limit cycle) state. The defining of the weight function of a network has further significance in the case of digital FIR filters, because the coefficients of some of the multiplier members of the FIR filter are none others than the samples of the weight function.

The „step” function of the MATLAB® gives opportunities in additional time domain analysis. In this case we examine the response of the network to l(t).

(6.13.. egyenlet)

6.9. ábra - The step response (the transfer response) of the network described with (6.1.) transfer function

Created by XMLmind XSL-FO Converter.

Page 41:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Network characteristics functions and their analysis

Usually the step response (the output response signal given for the step function, marked by l(t), or ε(t)) of the circuits is used for the examination (tipically for the settling-examination of controlling circuits) of the settling time of the reannexed systems. On the 6.9 Figure we can see the two-gate transfer function. In this function in time, given from the (6.1.) the transfer function.

Created by XMLmind XSL-FO Converter.

Page 42:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

7. fejezet - Time domain analysis of digital signal processing circuit without the use of special built-in MATLAB® functionIn case of the realization of the DSP (Digital Signal Processing) we are doing the programing of the time domain model. Finally our program goes into the FPGA, or into the digital signal processor, where the real-time working can be realized. In many cases our program, loaded into the target hardware, won’t work at first the way we expected, even though we didn’t make a „error” in our program. Now, the error means a programing miss!

The deviation from the expected working can have many sources, but usually it can be traced back to the representation of numbers characteristics of the given hardware. The MATLAB®, which is running in a PC environment, does the representation of numbers with floating point, with high accuracy, so the linear operations done by MATLAB®, with good approximation, will remain so. The MATLAB® model ergo describes the linear network models well (in practice with a good approximation). In practice, in case of the real-time working systems, the accuracy of the representation of numbers is usually much smaller than the accuracy used in the MATLAB®, so the impression of that can’t be ignored.

In case of fix point representation of numbers, if the number of bits is m, then we divided the dynamic domain of the representation of numbers (which we marked with D) into 2m parts. Then at the display of a sample the maximum error will be:

(7.1.. egyenlet)

The inaccuracy caused by the display is called quantization error. The absolute error is reducable by raising the bit number, but it is always going to be present.

Nowadays the advanced digital signal processors often have floating point arithmetic representation of numbers, but these accuracy (firstly because of the real-time working limits) is significantly lower than that used in MATLAB®.

An other representation of numbers problem is the overflow.

We are talking about overflow in case, when at some point of the digital signal processing device – during the execution of some operation – the obtained result is so big a number, that we can’t display it (given hardware limit).

If some number falls out from the representation range, and instead we represents some other, incorrect number, then this means that we bring noise into the system. The size of the noise depends on that, how much is the difference between the actually displayed number and the number we want to display. The size of the difference depends on that, what is the nature of the so-called overflow characteristics of the given device.

The following Figures show some of the overflow characteristics:

7.1. ábra - Modulo overflow characteristics

Created by XMLmind XSL-FO Converter.

Page 43:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Time domain analysis of digital signal processing circuit without

the use of special built-in MATLAB® function

7.2. ábra - Flooding overflow characteristics

7.3. ábra - Triangle overflow characteristic

From the characteristics we can see on the three Figures above the first (7.1 Figure Modulo overflow) is in fact the „untreated” overflow, namely in case of number overflow, occuring only with 1 LSB the error is added to the biggest degree.

Of course, the arithmetic of the nowadays used digital signal processors are prepared to handle the overflow problems (decrease them). Then usually the characteristic seen on the 7.2, or the 7.3 Figure is realized.

The flooding characteristics (7.2 Figure) resembles the overflow of analog systems, while the triangle characteristics (7.3 Figure) quickly restores the working from the overdriven state.

The problems listed above, like we already mentioned, can be shown with the simulation, executed in the time domain, of the signal processing network. During the simulation we are programming the structure which is equal to the concrete working, but in the present case the real-time working isn’t a requirement.

Theoretical basis for time domain simulation of discrete-time networks

Linear, in time invariant discrete-time systems are often described with the so-called equation of states. State variables are usually used on the input or output of one-pulse relays. From the view of our examinations it seems more favourable, if we determine the numerical values for each k-th pulse displayed on the output of all the components. So unlike with the state variable analysis, the network is described by the signals of the intersections. Intersection can be taken up on any point of the network. On the example of the 7.4 Figure for the analysis we took up nine intersections. From these the is a contracted summing – branching intersection, the➊

and branching, while the is a summing intersection.➋ ➌ ➒

Beside that for the examination of the multiplications imression we took up the intersections on the➍➎➏➐➑ output of the constant multipliers.

7.4. ábra - Second degree basic member (IIR filter)

Created by XMLmind XSL-FO Converter.

Page 44:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Time domain analysis of digital signal processing circuit without

the use of special built-in MATLAB® function

The equation described for every intersections:

y1(k) = xin(k) + y7(k) + y8(k)

y2(k) = y1(k-1)

y3(k) = y2(k-1)

y4(k) = d0 y1(k)⋅

y5(k) = d1 y2(k)⋅

y6(k) = d2 y3(k)⋅

y7(k) = c2 y3(k)⋅

y8(k) = c1 y2(k)⋅

y9(k) = yout(k) = y4(k) + y5(k) + y6(k).

Where the yi(k) is the signal of the i-th intersection k-th pulse. The equations can be placed in the following expressive form:

y1(k) - y7(k) - y8(k) = xin(k)

y2(k) = y1(k-1)

y3(k) = y2(k-1)

-do y1(k) + y4(k) = 0⋅

-d1 y2(k) + y5(k) = 0⋅

-d2 y3(k) + y6(k) = 0⋅

-c2 y3(k) + y7(k) = 0⋅

-c1 y2(k) + y8(k) = 0⋅

-y4(k) - y5(k) - y6(k) + y9(k) = 0 .

The system of equations described in matrix form:

Created by XMLmind XSL-FO Converter.

Page 45:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Time domain analysis of digital signal processing circuit without

the use of special built-in MATLAB® function

In other words we get the form.

In the k-th pulse the numerical value displayed on all intersection can be calculated on the basis of

where the M-1 is the inverse of the M matrix.

The description of the M matrix can be rather easily machinized according to the followings:

• The main diagonal is always 1.

• We recieve every other element of the matrix, if we assigne for every row and column one-one intersection, then watch on the signal flow graph, how do we get from one intersection to the other directly, while going in the opposite direction of the signal flow arrow.

If we can’t get directly from some intersection to the other – in the above mentioned way –, then in this position of the matrix we write 0, buti f we can get there directly, then here we write the constant multiplier times minus one, through which we get from one intersection to the other.

According to above – in the present example – the first row of the M is:

1 0 0 0 0 0 -1 -1 0,

so the main diagonal gets 1, the 7. and 8. column position gets -1, because going in the opposite direction of the arrow, to get to the 7. and the 8. intersection we go through 1 constant multiplier.

The elements of the g column vector are given by generating signals, which are the input signals of the intersectios. In the k-th pulse the k-th input signal {xin(k)}, and the stored samples {yn(k-1)} count as generating signals.

In the present example the source of the "1." intersection is the xin(k), the "2." intersection’s is the y1(k-1), the "3." intersection’s is the y2(k-1). Looking at the other intersections 0 is added, so other elements of g is zero.

The above introduced linear analysis, outside of determining the transfer characteristics is capable to display the overflow points.

In every tact we can determine the signal of all intersection, this way if some absolute value of the numerical value rises above the allowed value (it falls outside of displaying range), then it can be displayed.

The output samples of our signal processing network are going to stored in the y9 vector.

Make a MATLAB® program, which does the time domain analysys of the following signal processing network:

7.5. ábra - Simulated IIR filter

Created by XMLmind XSL-FO Converter.

Page 46:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Time domain analysis of digital signal processing circuit without

the use of special built-in MATLAB® function

The multiplier constanses are going to be these:

The Kronecker-delta (sampling counterpart of the Dirac-delta, which if we store in a vector, then all of the elements of the vector will be zero, but the first which id one) is going to be used as a generating signal.

Every k-th sample belonging to every intersection is stored in vectors assigned to their intersection.

The analysis was executed for 8000 pulse! For the examination write cycle, the results and partial results are stored in vectors belonging to their intersections.

Let’s examine the impulse response given on the output, then examine the Fourier transform of the impulse response (which is the frequency transfer characteristics of the filter). In reality the discrete Fourier transformation (DFT or FFT) of the s weight series gives the discrete samples of the transfer characteristics. Don’t forget that the transfer characteristics is a constant function, so by connecting the samples this function is well approachable.

%Second degree IIR structure low-pass filter analysis

%examined pulse number:

N=8000;

%feedforward multiplier constanses

d0=1;d1=2;d2=1;

%feedback multiplier constanses

c1=0.98650792405655952;

c2=-0.44679329164515174;

%matrix drescribing the IIR network

M=[1, 0, 0, 0, 0, 0, -1, -1, 0;

0, 1, 0, 0, 0, 0, 0, 0, 0;

0, 0, 1, 0, 0, 0, 0, 0, 0;

-d0, 0, 0, 1, 0, 0, 0, 0, 0;

Created by XMLmind XSL-FO Converter.

Page 47:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Time domain analysis of digital signal processing circuit without

the use of special built-in MATLAB® function

0, -d1, 0, 0, 1, 0, 0, 0, 0;

0, 0, -d2, 0, 0, 1, 0, 0, 0;

0, 0, -c2, 0, 0, 0, 1, 0, 0;

0, -c1, 0, 0, 0, 0, 0, 1, 0;

0, 0, 0, -1, -1, -1, 0, 0, 1];

Mi=inv(M);

%the creation and zeroing of the vectors storing the results of the intersections

y1=zeros(1,N);

y2=zeros(1,N);

y3=zeros(1,N);

y4=zeros(1,N);

y5=zeros(1,N);

y6=zeros(1,N);

y7=zeros(1,N);

y8=zeros(1,N);

y9=zeros(1,N);

%the definition of the vector temporarily storing the output results of the k-th pulse:

Y=zeros(1,9);

%Generating signal definition:

Xin=zeros(1,N);

Xin(2)=1; %Kronecker delta

for k=2:N; %scheduling cycle

g=[Xin(k), y1(k-1), y2(k-1), 0, 0, 0, 0, 0, 0]';

Y=Mi*g; %system of equations result in the k-th

pulse

%storing results in the vectors assigned to the intersections:

y1(k)=Y(1);

y2(k)=Y(2);

y3(k)=Y(3);

y4(k)=Y(4);

y5(k)=Y(5);

y6(k)=Y(6);

Created by XMLmind XSL-FO Converter.

Page 48:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Time domain analysis of digital signal processing circuit without

the use of special built-in MATLAB® function

y7(k)=Y(7);

y8(k)=Y(8);

y9(k)=Y(9);

end;

plot(y9);grid;title('súlysorozat ')

figure;

plot(20*log10(abs(fft(y9))));grid;title('súlysorozat Fourier transzformáltja')

The time domain analysis, if done in the form above, then we can examine the results appearing on every marked (taken) intersection of the signal processing network. The method (like we reviewed in the theoretical summary) can be effectively automated by computer, even from graphically drawn signal flow diagram too.

In the next example we can see the time domain analysis of a wave-digital Lattice filter (Lattice WDF also called „Gazsi filters”):

(7.2.. egyenlet)

Created by XMLmind XSL-FO Converter.

Page 49:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Time domain analysis of digital signal processing circuit without

the use of special built-in MATLAB® function

In the program above we chosen a wave-digital low-pass filter with a Lattice structure as a simulation subject. The characteristics parameters of the signal processing circuit in the

matrix contains the spara40 file, which are read at the start of the program. The elements of the matrix are these:

7.3

Further, a not yet known function can be seen in the rows of the (7.2.) program, namely the Q1 function. This function isn’t available MATLAB® function, but something we ourselves can create. The function of the Q1 function is to „spoil” the representation of numbers accuracy of the MATLAB® and this way we can see a real-time result.

In the example above the buildup of the Q1 function is as follows:

(7.4.. egyenlet)

The Q1 function ergo doesn’t do anything except it stumps the „x” number given in the input variable acording to an „n” bit fixed point representation of number.

The floor function is the available function of the MATLAB®, which rounds a given number in the direction of the minus infinity.

The result of the (7.2.) execution [using the (7.3.) and the (7.4.)] is the following:

7.6. ábra - The transfer characteristics of the low-pass wave-digital filter in the function of frequency (FFT 512 absolute value)

Created by XMLmind XSL-FO Converter.

Page 50:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Time domain analysis of digital signal processing circuit without

the use of special built-in MATLAB® function

On the 7.6 Figure we can see the Fourier transform of the result of the time domain analysis. Our generating signal was a digital dirac-delta function which resulted an impulse response (weight function) on the output of the circuit.

The original (7.2. execution) simulation result can be seen by displaying the y2 vector, for example like this:

(7.5.. egyenlet)

The result is as follows:

7.7. ábra - Weight function of the low-pass wave-digital filter

In the case of, if we leave out the ringing off part of the weight function, we can examine the stability of our filter, namely the ring off of the impulse response. On the coming Figure we examine the ringing off part of the

Created by XMLmind XSL-FO Converter.

Page 51:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

Time domain analysis of digital signal processing circuit without

the use of special built-in MATLAB® function

weight function:

7.8. ábra - The enlargement of the ringing off part of the weight function of the low-pass wave-digital filter

On the 7.8 Figure we can see that the signal processing network is operated stably next to the given excitation conditions. This, of course, isn’t always the case, it is practical to examine the DSP algorithm with a simulation in every case, like with the use of the MATLAB® program.

Created by XMLmind XSL-FO Converter.

Page 52:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

8. fejezet - The communication toolsIn this chapter we present some special MATLAB® function. Here is mainly the communication tools will be examined. Now we consider digital modulation procedures.

First we need some prepare to modulate. Lets see…

1. Generate a random binary data streamThe conventional format for representing a signal in MATLAB® is a vector or a matrix.

Now we use the randint function which generate a column vector with element of binary data stream. The length of te vector is 50.

(8.1.. egyenlet)

Plot the 50 bits in a stem plot:

(8.2.. egyenlet)

8.1. ábra - The stem plot of random binary data stream

2. Make 4-tuples of binary data streamIf we vant to transmit this binary stream with 16QAM, we need to convert the stream to integers 0 and 15 rather that 4-tuples of bits. To reshape the prvious x vector, using the bi2de MATLAB® function. The bi2de convert binary vectors to decimal numbers. Lets see two examples:

(8.3.. egyenlet)

The results:

Created by XMLmind XSL-FO Converter.

Page 53:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

The communication tools

D=[12,5], it means, the ’0 0 1 1’ pattern equal with decimal 12, when the right bit is a msb (default), and in this case the ’1 0 1 0’ pattern interpreted as 5.

At the result E, the left bit interpreted as a most significant bit (msb), and the right an a least significant bit (lsb). So the E vector contain two numbers: 3 and 10.

If we vant to convert a column vector which contain random binary data stream, we should reshape first this vector. The next example lets make a column vector ’x’ with 20 elements, and reshape to 4-tuple units (using the command line again):

(8.4.. egyenlet)

The result from x’= 0 1 1 0 0 0 1 0 1 0 1 0 1 1 1 1 1 0 0 0

after the reshape:

x4 =

0 0 1 1 1

1 0 0 1 0

1 1 1 1 0

0 0 0 1 0

Now we can convert the binary vectors to decimal numbers:

(8.5.. egyenlet)

The result:

xdec =

6

2

10

15

8

Dont forget, we are using the random generator, to generate the x vector, so if we re-running the above examples, we get different results!

3. Modulate using 16QAMPreviously we made the xdec vector which elements are decimal numbers with 0 to 15 values.

Let’s modulate the xdec with qammod MATLAB® function!

(8.6.. egyenlet)

The result:

y =

Created by XMLmind XSL-FO Converter.

Page 54:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

The communication tools

-1.0000 - 1.0000i

-3.0000 - 1.0000i

1.0000 - 1.0000i

3.0000 - 3.0000i

1.0000 + 3.0000i

Let’s see the results in constellation diagram:

(8.7.. egyenlet)

8.2. ábra - Scatter plot of 16QAM previous five symbols

In this constellation diagram we can see the above result from y vector.

4. Pass trough at AWGN channelIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise.

Applying the awgn MATLAB® function to the modulated signals adds the white Gausian noise to it. First we sholuld make a bit longer simulation than before (using more random elements):

(8.8.. egyenlet)

Now we can see the 16 symbols of 16QAM:

8.3. ábra - All symbols in 16QAM

Created by XMLmind XSL-FO Converter.

Page 55:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

The communication tools

Lets add some noise! The ratio of bit energy to noise power densitiy (Eb/No) in this example arbitrarily set at 10dB. From Eb/No derive the SNR (Signal Noise Ratio).

In this example one symbol describes 4 bits, so SNR = Eb/No+10*log(4).

(8.9.. egyenlet)

The result now:

snr =

16.0206

Pass trougth the y signal AWGN channel:

(8.10.. egyenlet)

…and let’s see the results in constellation diagram!

(8.11.. egyenlet)

8.4. ábra - 16QAM loaded with random noise

Created by XMLmind XSL-FO Converter.

Page 56:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

The communication tools

In this picture (above), we have 2000 pieces of QAM16 symbols with random noise.

5. Demodulate the 16QAMIf we received the noisy QAM symbols, we can demodulated it, with qamdemod MATLAB® function. The received result stored in ynoisy vector.

(8.12.. egyenlet)

We produced the xdemodulated, a vector of integers.

6. Convert the integer-valued stream to binary data streamTo obtain an equivalent binary signal (from xdemodulated vector), use the de2bi MATLAB® function to convert each integer to a corresponding binary 4-tuple along a row of a matrix. Then use the reshape MATLAB® function to arrange all the bit in single column vector insted than four column matrix.

(8.13.. egyenlet)

We prepared the demodulated bitstream from noise loaded 16QAM signal, so we can compare this result with the original stream.

7. Compute the BER (Bit Error Ratio)Applying the biterr MATLAB® function to calculate the number of bit errors and the bit error ratio:

Created by XMLmind XSL-FO Converter.

Page 57:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

The communication tools

(8.14.. egyenlet)

In this run the results are:

If we using more bits in bitstream and change the value of SNR parameter, we get other statistics. Now lets simulate the QAM modulate – demodulate chain with the following commands:

(8.15.. egyenlet)

In this run the results are:

In previous simulation we added more noise to QAM symbols.

8.5. ábra - 16QAM loaded with random noise (SNR=8dB)

Created by XMLmind XSL-FO Converter.

Page 58:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

The communication tools

Don’t forget, the simmulation results might vary, because the simulation uses random numbers for bitstream and noise too.

8. Show the symbol mappingSometimes we interest the binary coded signal constellation. First we should make a vector with integer numbers from 0 to „N”, where „N” means the number of states in digital modulation, minus one. So, if we use 16QAM, the N=15.

First we produce a vector with integer numbers from 0 to 15:

(8.15.. egyenlet)

The result now:

x_vector =

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Assign a symbol to each integer numbers of vector:

…and show the symbols:

(8.16.. egyenlet)

8.6. ábra - 16QAM symbols

If we want to show the symbols of 256 QAM, we should execute the following commands:

Created by XMLmind XSL-FO Converter.

Page 59:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

The communication tools

(8.17.. egyenlet)

The result:

8.7. ábra - 256QAM symbols

To annotate the plot to show the relationship between the x_vector and y vector, we should use the MATLAB® text function to place a number in the plot beside each constellation point.

Let’s check the QAM16 again!

(8.18.. egyenlet)

Lets see the result in constellation Figure:

8.8. ábra - 16QAM binary coded symbols

Created by XMLmind XSL-FO Converter.

Page 60:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

The communication tools

Above we can see, the neighbour symbols with each other have more Haming distance one, so the qammod MATLAB® function did not use a Gray-coded signal constellation.

9. Gray Coding solutionsThe qammod and qamdemod MATLAB® functions use fixed signal constellations, The Haming distance between two neighbor symbol sometimes greater than one (we can see this in Figure 8.8).

Now let’s understand an MATLAB® example! Type in the MATLAB® command window this:

(8.19.. egyenlet)

In the editor windows we can see the following source code:

%% Incorporating Gray Coding

% This example, described in the Getting Started chapter of the

% Communications Toolbox documentation, aims to solve the following

% problem:

%

% Modify the modulation example (COMMDOC_MOD) so that it uses

% a Gray-coded signal constellation.

% Copyright 1996-2009 The MathWorks, Inc.

% $Revision: 1.1.8.2 $ $Date: 2009/07/20 17:37:55 $

%% Setup

% Define parameters.

M = 16; % Size of signal constellation

k = log2(M); % Number of bits per symbol

Created by XMLmind XSL-FO Converter.

Page 61:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

The communication tools

n = 3e4; % Number of bits to process

nSamp = 1; % Oversampling rate

%% Create Modulator and Demodulator

hMod = modem.qammod(M); % Create a 16-QAM modulator

hMod.InputType = 'Bit'; % Accept bits as inputs

hMod.SymbolOrder = 'Gray'; % Accept bits as inputs

hDemod = modem.qamdemod(hMod); % Create a 16-QAM based on the modulator

%% Signal Source

% Create a binary data stream as a column vector.

x = randi([0 1],n,1); % Random binary data stream

%% Modulation

% Modulate using 16-QAM.

y = modulate(hMod,x);

%% Transmitted Signal

yTx = y;

%% Channel

% Send signal over an AWGN channel.

EbNo = 10; % In dB

SNR = EbNo + 10*log10(k) - 10*log10(nSamp);

yNoisy = awgn(yTx,SNR,'measured');

%% Received Signal

yRx = yNoisy;

%% Scatter Plot

% Create scatter plot of noisy signal and ideal constellation points

hScatter = commscope.ScatterPlot; % Create a scatter plot scope

hScatter.Constellation = hMod.Constellation; % Set expected constellation

hScatter.SamplesPerSymbol = nSamp; % Set oversampling rate

hScatter.PlotSettings.Constellation = 'on'; % Display ideal constellation

update(hScatter, yRx(1:5e3)) % Send received signal to the scope

title('Received Signal');

%% Demodulation

% Demodulate signal using 16-QAM.

Created by XMLmind XSL-FO Converter.

Page 62:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

The communication tools

z = demodulate(hDemod,yRx);

%% BER Computation

% Compare x and z to obtain the number of errors and

% the bit error rate.

[number_of_errors,bit_error_rate] = biterr(x,z)

At the start of source code define the start parameters, then create the modulator and demodulator. The x vector stores the binary random data stream as a 30000 element column vector. The vector y stores the modulated symbols, and equal with transmitted signal, called yTx. After pass trougth yTx in AWGN channel, the received signal stored in yRx vector.

Now let’s see the result in scatterplot:

8.9. ábra - 16QAM binary coded symbols

10. Pulse shapingPulse shaping filters are used at the heart of many modern data transmission systems to keep a signal in an allocated channel bandwidth. The main goal, maximize its data transmission rate and minimize transmission errors.

Created by XMLmind XSL-FO Converter.

Page 63:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

The communication tools

The ideal pulse shaping filter has two properties:

• infinite stopband attenuation,

• the impulse response of the shaping filter should have zero crossings at multiples of the symbol period.

These features eleminates the inter symbol interference (ISI). Unfortunately, the ideal pulse shaping filter is not realizeable.

A raised cosine filter is typically used to shape a symbol stream before transmission.

We can design the raised cosine filters wit the help of MATLAB® function:

(8.20.. egyenlet)

The result is, impulse response of filter:

8.10. ábra - Impulse response of raised cosine filter

We can check the result in frequency domain too:

(8.21.. egyenlet)

8.11. ábra - Frequency response of raised cosine filter

Created by XMLmind XSL-FO Converter.

Page 64:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

The communication tools

11. Eye-diagramAfter the filtering the modulated signal, we can see the eye-diagram with the help of eyediagram MATLAB® function. The eye-diagram illustrates the effect of the pulse shaping.

Let’s run the following commands in command window:

(8.22.. egyenlet)

The results are represented in two diagrams. The first diagram represents the eye-diagram of in-phase signal, and the second represents the eye-diagram of quadrature-phase signal.

8.11. ábra - Eye-diagram of modulated signal

Created by XMLmind XSL-FO Converter.

Page 65:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

The communication tools

12. Communication channel modelsIn previous section we were used the simple additive noise (AWGN) channel. In this modell uses the withe Gausian noise which noise adds to the signal that passes trough it.

The awgn MATLAB function realise the AWGN function: add white Gaussian noise to a signal.

Y = AWGN(X,SNR) adds white Gaussian noise to X. The SNR is in dB. The power of X is assumed to be 0 dBW. If X is complex, then AWGN adds complex noise.

Let’s see an example!

Specify the power of X to be 0 dBW and add noise to produce an SNR of 10dB, use:

(8.23.. egyenlet)

The result:

Created by XMLmind XSL-FO Converter.

Page 66:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

The communication tools

8.12. ábra - Gaussian noise loaded signal

The Fading channel model uses in wireless communication simulation. The MATLAB® communication toolbox inplements a baseband channel modell for multipath propagation. Two MATLAB® objects available, the rayleighchan and ricianchan.

The rayleighchan function can simulate one or more major reflected path.

The ch = rayleighchan(TS,FD) constructs a frequency-flat ("single path") Rayleigh fading channel object. It is the sample time of the input signal, in seconds. The FD is the maximum Doppler shift, in Hertz. You can model the effect of the channel on a signal x by using the syntax y = filter(ch,x).

For more information type the command window the:

The ricianchan function can simulate one direct line-of-sight path, possibly combined with one or more major reflected path.

Ch = ricianchan(TS,FD,K) constructs a frequency-flat ("singlepath") Rician fading channel object. TS is the sample time of the input signal, in seconds. FD is the maximum Doppler shift, in Hertz. K is the Rician K-factor in linear scale.

For more information type the command window the:

The Binary Symmetric Channel modelcorrupts a binary signal by reversing each bit with a fixed probapility. This channel can be useful for testing errorr control coding.

To model a Binary Symmetric Channel use the bsc MATLAB® function.

The ndata = bsc(data,p) passes the binary input signal data through a binary symmetric channel with error probability p. The channel introduces a bit error with probability p, processing each element of data independently.

Let’s see the following example!

Created by XMLmind XSL-FO Converter.

Page 67:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

The communication tools

(8.24.. egyenlet)

The results:

At the end I wish you success and hard work with MATLAB®!

Created by XMLmind XSL-FO Converter.

Page 68:   · Web viewIf we pass trough the QAM signal via transmission channel it has distorsion (phase distorsion and amplitude distorsion), and loaded with noise. Applying the awgn MATLAB®

IrodalomjegyzékComplex, But Not Complicated. Richard, Lyons, Quadrature Signals.

Villamosságtan II. (49 203/II.). Selmeczi, Kálmán, Schnöller Antal.

Hírközlés Elmélet. Ferenczy, Pál. 1974. Budapest. Tankönyvkiadó.

A Hírközlés rendszerelmélete. Gordos, Géza. 1983 V.107. Budapest.

Lineáris áramkörök tervezése. Géher, Károly, Solymosi János.

MATLAB® help.

www.mathworks.com .

Created by XMLmind XSL-FO Converter.