EGR324L: Linear Systems and Signals Lab Lab 2: Vector Manipulations and Graphical Plotting Objective To learn Matlab operations on vectors, including vector import and export procedures. To get...

1 answer below »
I have these problems in attachment. I want you guys to solve them using MATLAB-Check the Attachment for more instruction


EGR324L: Linear Systems and Signals Lab Lab 2: Vector Manipulations and Graphical Plotting Objective To learn Matlab operations on vectors, including vector import and export procedures. To get familiar with Matlab’s graphical plotting facilities. Background Matrix Manipulation The basic objects manipulated by Matlab are 2-dimensional matrices. A vector is a special cases of a matrix, which has only one row or one column. To avoid confusion, a vector of N elements is defined, for this class, as a matrix of N by 1 elements, that is, a matrix of N rows by 1 (one) column. In case an operation only takes a row vector, a transpose operation should be inserted wherever appropriate to accommodate the function. You may discover that Matlab is extremely powerful in doing matrix manipulations, as a scalar operation is applied to all elements of a matrix "in parallel". This eliminates almost completely the need of iterative operators (for and while loops) commonly employed in conventional programming languages. For instance, to calculate s[n] = sin (27πn/1000) for n = 1, ..., 1000, we write the following program in Pascal: for n := 1 to 1000 do s[n] := sin(2 * PI * n / 1000); In Matlab, we could use a for loop, for n = 1:1000, s(n) = sin(2 * pi * n / 1000); end Or simply s = sin(2 * pi * (1 : 1000) / 1000) Since Matlab programs are interpreted (not compiled), for loops and while loops are very inefficient. They should be avoided whenever possible. Data Import and Export Data generated by other programs can be imported into Matlab with the load command. The raw data can be in an ASCII file. On the other hand, Matlab may also generate data to be processed by other programs. The command to be used in this case is save. To export vector x (N by 1 matrix) to a file called x.dat in ASCII, use command >> save x.dat x /ascii It is considered a good practice to assign the same name to the variable and the file, like in this example, although both names can be arbitrary. To import data from a file called x.dat in ASCII, type >> load x.dat /ascii The content of the file will be loaded to variable x. If the file contains N rows, and each row contains exactly one number, x will be a N by 1 matrix, namely, a vector. Graphical Plotting in Matlab Matlab supports graphical plotting on both computer screen and on a printer. The command for plotting on the screen is plot, which is used in a number of formats. >> plot(y) Plot vector y versus their indices. >> plot(x, y) Plot vector y versus vector x with the default line type. >> plot(x, y, ’’) Plot vector y versus vector x with specified . Possible line types include line, point and color specifications which are given in the Matlab book as well as in the on-line help. Command plot can also take other forms for its argument list. Please see the Matlab book for a detailed discussion of this command. Several other commands are used to help generating the desired plot. They include: axis, hold, title, xlabel, ylabel, text, gtext, etc. Some of them will be needed for this assignment. Please see the Matlab book, or use on-line help for details of these commands. Use command print to obtain a high quality hard copy of the current screen plot. Preparation Please read the following topics from the Matlab book. Instructions will also be given during the lab session. · Built-in operators for vector manipulation :(range selector), ’(transpose), +, -, *, /, ^, .*, ./, and .^. · Language constructs for, while, end, if, break. · Commands to generate graphical plots plot, bar, stairs, title, xlabel, ylabel, text, gtext, hold, axis, grid, clg and print. · Built-in functions rem, round, ceiling, floor, fix Do not be frustrated if you do not understand some of the material of linear algebra -- just skip it. Problems (1) Let x[n] = n, for n = 1,…, 8. Calculate and plot , for n=1, ..., 8. (2) Compute and plot x[n] = for n = 1,..., 1000. On the same graph, plot e-0.003n and -e-0.003n with another color or line type. Electronically mark the curves to identify each individual one. (3) Using Matlab to plot the drawing illustrated below. You only need to plot along the black lines. (4) Given x[n] = sin(n/100), generate and plot the following vectors for -628 < n="">< 628.="" a.="" generate="" x[n],="" y[n]="0.5·x[2n]" and="" z[n]="0.2·x[5n]." plot="" all="" three="" on="" one="" graph.="" b.="" generate="" x[n],="" v[n]="x[n" -="" 100]="" and="" w[n]="x[n" +="" 150].="" plot="" all="" three="" on="" one="" graph.="" report="" (1)="" a="" script="" (.m)="" file="" should="" be="" created="" for="" each="" problem.="" (2)="" make="" sure="" you="" show="" only="" important="" intermediate="" results,="" response="" from="" matlab="" should="" be="" suppressed="" for="" obvious="" or="" tedious="" operations="" (for="" instance,="" assign="" a="" constant="" to="" a="" variable).="" (3)="" all="" script="" files="" should="" contain="" comments="" detailed="" enough="" for="" understanding="" your="" program.="" (4)="" turn="" in="" all="" .m="" files,="" the="" diary="" created="" in="" (4),="" and="" all="" graphical="" plots.="" (5)="" write="" a="" paragraph="" about="" questions="" and="" confusions="" you="" have="" experienced="" about="" this="" experiment.="" egr324l:="" linear="" systems="" and="" signals="" lab="" lab="" 1:="" introduction="" to="" matlab="" and="" complex="" number="" manipulation="" objective="" to="" learn="" how="" to="" access="" matlab="" and="" to="" get="" familiar="" with="" basic="" operation="" procedures="" of="" matlab.="" to="" review="" numerical="" calculation="" of="" complex="" numbers="" using="" matlab.="" background="" matlab="" by="" mathworks="" inc.,="" is="" a="" computing="" environment="" specially="" designed="" for="" matrix="" computations.="" it="" has="" widely="" used="" in="" the="" study="" of="" circuits,="" signal="" analysis="" and="" processing,="" control="" systems,="" etc.="" its="" large="" library="" of="" built-in="" functions="" and="" graphical="" capability="" makes="" it="" a="" valuable="" tool="" in="" engineering="" education="" and="" research.="" matlab="" has="" an="" interactive="" mode,="" in="" which="" user="" statements="" are="" interpreted="" immediately="" as="" they="" are="" typed.="" alternatively,="" a="" program="" can="" be="" written="" in="" advance="" using="" a="" text="" editor,="" saved="" as="" disk="" files,="" and="" then="" executed="" in="" matlab.="" preparation="" although="" the="" basic="" objects="" manipulated="" by="" matlab="" is="" matrix,="" we="" only="" deal="" with="" complex="" number="" (scalars)="" in="" this="" assignment.="" please="" read="" the="" following="" topics="" from="" matlab="" manual="" or="" from="" the="" optional="" textbook,="" "="" the="" student="" edition="" of="" matlab="" ".="" your="" instructor="" will="" also="" give="" instructions="" during="" the="" lab="" session.="" ·="" command="" mode="" operation="" ·="" on-line="" help="" ·="" script="" editing="" and="" execution="" ·="" command="" language="" constants,="" variables,="" expressions.="" assignments,="" m-files,="" function="" calls,="" function="" definitions,="" and="" comments.="" ·="" matlab="" commands="" diary,="" echo,="" type,="" !,="" pause,="" quit,="" who="" and="" whos="" ·="" predefined="" variables="" ans,="" i,="" j="" and="" pi.="" ·="" built-in="" operators="" +,="" -,="" *,="" and="" ^="" ·="" built-in="" functions="" abs,="" angle,="" clear,="" conj,="" cos,="" exp,="" imag,="" real,="" sin="" and="" sqrt.="" problems="" (1)="" express="" the="" following="" in="" both="" polar="" form="" and="" rectangle="" form="" using="" matlab.="" (2)="" find="" roots="" for="" the="" following="" equations="" using="" matlab.="" a.="" 3.72x2="" +="" 2.="" 1x="" +="" 8.25="0" b.="" 4x2="" +="" 25x="" -="" 56="0" (3)="" a="" complex="" number="" y="a" +="" jb="" is="" perpendicular="" to="" that="" of="" x="c" +="" jd="" if="" a="-d" and="" b="c." define="" a="" function="" y="perp(x)," which="" takes="" a="" complex="" number="" x="" as="" input,="" and="" returns="" a="" complex="" number="" y,="" which="" is="" perpendicular="" to="" x.="" (4)="" using="" function="" perp="" defined="" in="" (3),="" find="" complex="" numbers="" perpendicular="" to="" respectively.="" report="" (1)="" a="" script="" (.m)="" file="" should="" be="" created="" for="" each="" calculation.="" they="" may="" be="" named="" prob_1_a.m="" for="" problem="" 1="" (a).="" etc..="" script="" files="" for="" user="" function="" definitions="" should="" have="" their="" proper="" names="" based="" on="" functionality.="" (2)="" make="" sure="" you="" show="" only="" important="" intermediate="" results,="" responses="" from="" matlab="" should="" be="" suppressed="" for="" obvious="" or="" tedious="" operations="" (for="" instance,="" assign="" a="" constant="" to="" a="" variable).="" (3)="" all="" script="" files="" should="" contain="" comments="" detailed="" enough="" for="" understanding="" your="" program.="" (4)="" a="" session="" diary="" that="" records="" the="" execution="" of="" all="" script="" files="" should="" be="" created.="" the="" following="" is="" a="" sample="" session="" diary="" for="" this="" experiment.="">> prob_1_a (execution of code for Problem 1(a)) >> prob_1_b (execution of code for Problem 1(a)) (5)You should turn in all m files along with the file that records the diary session. This file may be named lab_1. Specifically, you need to turn in the following files for this experiment. prob_1_a. m prob_l_b.m prob_1_c.m prob_2_a.m prob_2_b.m perp.m prob_4_a.m prob_4_b.m prob_4_c.m lab_1
Answered Same DaySep 08, 2021

Answer To: EGR324L: Linear Systems and Signals Lab Lab 2: Vector Manipulations and Graphical Plotting Objective...

Intakhab answered on Sep 10 2021
159 Votes
EGR324L: Linear Systems and Signals Lab
Lab 1: Introduction to Matlab and Complex Number Manipulati
on
Problem 1 (a)
Matlab code
Z=((1-i*(sqrt(3))).^3)+i*(1+i)*exp((i*pi)/6);%complex number
A=abs(Z) %gives absolute value
theta=angle(Z) %gives angle
x=A*(cos(theta)+i*(sin(theta))) %polar form
Solution
>> Problem_1_a
A =
9.3732
theta =
3.1025
x =
-9.3660 + 0.3660i
Problem 1 (b)
Matlab Code
Z=((2-i*((6)/(sqrt(3))))/(2+i*((6)/(sqrt(3)))))/((exp(i*pi/3)-1)/(1+i*(sqrt(3)))) %complex number
A=abs(Z) %gives absolute value
theta=angle(Z) %gives angle
x=A*(cos(theta)+i*(sin(theta))) %polar form
Solution
>> problem_1_b
Z =
-2.0000
A =
2.0000
theta =
3.1416
x =
-2.0000 + 0.0000i
Problem 1 c
Matlab code
Z=((sqrt(3)+i)*2*(sqrt(2))*exp(i*pi/4))^0.6 %complex number
A=abs(Z) ...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here