Matlab Sheet 2 Arrays









matlab-basic-functions-reference.pdf

Create vector of n equally spaced values logspace(ab
matlab basic functions reference


GEOMETRIC MEANS IN A NOVEL VECTOR SPACE STRUCTURE

Sym(n) is the vector space of real n × n symmetric matrices. write log(M) for the principal logarithm of a matrix M whenever it is defined.
arsigny siam tensors


MATLAB Function Reference (Volume 1: Language)

Generate logarithmically spaced vectors ones. Create an array of all ones rand. Uniformly distributed random numbers and arrays.
a ffbc e a d e b a ed df


Initiation au logiciel " Matlab "

ELEMENTARY MATRICES AND MATRIX MANIPULATION. On obtient les informations sur une fonction (contenue dans Matlab ou ... Logarithmically spaced vector.
InitiationAideMatlab





Matlab Sheet 2 Arrays

Matlab Sheet 2 Solution. Matlab Sheet 2. Arrays. 1. a. Create the vector x having 50 logarithmically spaced values starting at. 10 and ending at 1000.
Matlab Sheet solution


MATLAB Commands and Functions

Matrix Commands for Solving Linear Equations / 6 Lists all MATLAB files in the current directory. wklread ... Creates logarithmically spaced vector.
MatlabCommands


INTRODUCTION TO MATLAB FOR ENGINEERING STUDENTS

After logging into your account you can enter MATLAB by double-clicking on the MATLAB there is a command to generate linearly spaced vectors: linspace.
introduction to matlab


Initiation au logiciel " Matlab "

ELEMENTARY MATRICES AND MATRIX MANIPULATION. Le logiciel Matlab est ouvert dans la fenêtre de commande Matlab Mcw ... Logarithmically spaced vector.
Initiation Aide Matlab





MATLAB Fundamentals - Cheat Sheet - Tools Course ETH Zürich

MATLAB Fundamentals - Cheat Sheet - Tools Course ETH Zürich. Basics. Workspace mathworks.com/help/matlab/ ... Log. spaced vector (50 elements).
ML CheatSheet


Introduction to MATLAB II representation of signals and computing

Vector Matrix and Array Commands. Some of MATLAB functions operate essentially on a vector (row or column)
experiment


213574 Matlab Sheet 2 Arrays Faculty of Engineering Spring 2017 Mechanical Engineering Department Dr./ Ahmed Nagib Elmekawy 1 of 32 Matlab Sheet 2 Solution

Matlab Sheet 2

Arrays

1. a. Create the vector x having 50 logarithmically spaced values starting at

10 and ending at 1000.

b. Create the vector x having 20 logarithmically spaced values starting at

10 and ending at 1000.

The m-file:

x1=logspace(1,3) x2=logspace(1,3,20)

2. Create a row vector that has the following elements: 8, 10/4, 12ൈ1.4, 51,

tan 85°,ξʹ͸ , and 0.15.

The m-file:

row=[8 10/4 12*1.4 51 tand(85) sqrt(26) 0.15]

In Command Window:

row =

8 2.5 16.8 51 11.43 5.099 0.15

3. Create a row vector in which the first element is 1 and the last element is 43,

The m-file:

row=1:6:43

In Command Window:

row =

1 7 13 19 25 31 37 43

Faculty of Engineering Spring 2017 Mechanical Engineering Department Dr./ Ahmed Nagib Elmekawy 2 of 32 Matlab Sheet 2 Solution

4. Use a single command to create a row vector (assign it to a variable named b)

with 11 elements, such that b = 0 2 4 6 8 10 12 9 6 3 0

Do not type the vector explicitly.

The m-file:

b=[0:2:12 9:-3:0]

In Command Window:

b =

0 2 4 6 8 10 12 9 6 3 0

5. Create two row vectors: a=2:3:17 and b=3:4:15. Then, by only using the name

of the vectors (a and b), create a row vector c that is made from the elements of a followed by the elements of b.

The m-file:

a=2:3:17; b=3:4:15; c=[a,b]

In Command Window:

c =

2 5 8 11 14 17 3 7 11 15

name of the vectors (a and b), create a column vector c that is made from the elements of a followed by the elements of b.

The m-file:

a=[2:3:17]'; b=[3:4:15]'; c=[a;b]

In Command Window:

c = 2 5 8 11 Faculty of Engineering Spring 2017 Mechanical Engineering Department Dr./ Ahmed Nagib Elmekawy 3 of 32 Matlab Sheet 2 Solution 14 17 3 7 11 15

7. A Type this matrix in MATLAB and use MATLAB to carry out the following

Instructions:

a. Create a vector v consisting of the elements in the second column of A. b. Create a vector w consisting of the elements in the second row of A.

The m-file:

A = [3,7,-4,12;-5,9,10,2;6,13,8,11;15,5,4,1];

v = A(:,2) w = A(2,:)

In Command Window:

v = 7 9 13 5 w = -5 9 10 2 Faculty of Engineering Spring 2017 Mechanical Engineering Department Dr./ Ahmed Nagib Elmekawy 4 of 32 Matlab Sheet 2 Solution

8. Create the following matrix by using vector notation for creating vectors with

constant spacing and/or the linspace command. Do not type individual elements explicitly.

The m-file:

A=[130:-20:10; linspace(1,12,7); 12:10:72]

In Command Window:

A= A =

130 110 90 70 50 30 10

1. 2.8333 4.6667 6.5000 8.3333 10.1667 12.0000

12 22 32 42 52 62 72

9. Create the following matrix by typing one command. Do not type individual

elements explicitly.

The m-file:

Faculty of Engineering Spring 2017 Mechanical Engineering Department Dr./ Ahmed Nagib Elmekawy 1 of 32 Matlab Sheet 2 Solution

Matlab Sheet 2

Arrays

1. a. Create the vector x having 50 logarithmically spaced values starting at

10 and ending at 1000.

b. Create the vector x having 20 logarithmically spaced values starting at

10 and ending at 1000.

The m-file:

x1=logspace(1,3) x2=logspace(1,3,20)

2. Create a row vector that has the following elements: 8, 10/4, 12ൈ1.4, 51,

tan 85°,ξʹ͸ , and 0.15.

The m-file:

row=[8 10/4 12*1.4 51 tand(85) sqrt(26) 0.15]

In Command Window:

row =

8 2.5 16.8 51 11.43 5.099 0.15

3. Create a row vector in which the first element is 1 and the last element is 43,

The m-file:

row=1:6:43

In Command Window:

row =

1 7 13 19 25 31 37 43

Faculty of Engineering Spring 2017 Mechanical Engineering Department Dr./ Ahmed Nagib Elmekawy 2 of 32 Matlab Sheet 2 Solution

4. Use a single command to create a row vector (assign it to a variable named b)

with 11 elements, such that b = 0 2 4 6 8 10 12 9 6 3 0

Do not type the vector explicitly.

The m-file:

b=[0:2:12 9:-3:0]

In Command Window:

b =

0 2 4 6 8 10 12 9 6 3 0

5. Create two row vectors: a=2:3:17 and b=3:4:15. Then, by only using the name

of the vectors (a and b), create a row vector c that is made from the elements of a followed by the elements of b.

The m-file:

a=2:3:17; b=3:4:15; c=[a,b]

In Command Window:

c =

2 5 8 11 14 17 3 7 11 15

name of the vectors (a and b), create a column vector c that is made from the elements of a followed by the elements of b.

The m-file:

a=[2:3:17]'; b=[3:4:15]'; c=[a;b]

In Command Window:

c = 2 5 8 11 Faculty of Engineering Spring 2017 Mechanical Engineering Department Dr./ Ahmed Nagib Elmekawy 3 of 32 Matlab Sheet 2 Solution 14 17 3 7 11 15

7. A Type this matrix in MATLAB and use MATLAB to carry out the following

Instructions:

a. Create a vector v consisting of the elements in the second column of A. b. Create a vector w consisting of the elements in the second row of A.

The m-file:

A = [3,7,-4,12;-5,9,10,2;6,13,8,11;15,5,4,1];

v = A(:,2) w = A(2,:)

In Command Window:

v = 7 9 13 5 w = -5 9 10 2 Faculty of Engineering Spring 2017 Mechanical Engineering Department Dr./ Ahmed Nagib Elmekawy 4 of 32 Matlab Sheet 2 Solution

8. Create the following matrix by using vector notation for creating vectors with

constant spacing and/or the linspace command. Do not type individual elements explicitly.

The m-file:

A=[130:-20:10; linspace(1,12,7); 12:10:72]

In Command Window:

A= A =

130 110 90 70 50 30 10

1. 2.8333 4.6667 6.5000 8.3333 10.1667 12.0000

12 22 32 42 52 62 72

9. Create the following matrix by typing one command. Do not type individual

elements explicitly.

The m-file:


  1. logarithmic spaced vector matlab
  2. matlab create log spaced vector
  3. matlab generate log spaced vector