Please solve by using MATLAB thanks Creating vectors Generat

Please solve by using MATLAB thanks

Creating vectors Generate the following vectors: A = [1 0 4 5 3 9 0 2] a = [4 5 0 2 0 0 7 1] Be aware that Matlab are case sensitive. Vector A and a have different values. Generate the following vectors: B = [A a] C = [a, A] Concatenation is the process of joining small matrices to make bigger ones. In fact, you made your first matrix by concatenating its individual elements. The pair of square brackets, [], is the concatenation operator. Generate the following vectors using function zeros () and ones (): D = [0 0 0 ... 0] with fifty 0\'s. E = [1 1 1 ... 1] with a hundred l\'s. Generate the following vectors using the colon operator F = [12 34... 30] G = [25 22 19 16 13 10 7 4 1] H = [0 0.2 0.4 0.6 ... 2.0] The colon, :, is one of Matlab\'s most important operators.

Solution

>> %Generating following vectors
>> A = [1 0 4 5 3 9 0 2];
>> a = [4 5 0 2 0 0 7 1];
>> A

A =

1 0 4 5 3 9 0 2

>> a

a =

4 5 0 2 0 0 7 1

>> B = [A a];
>> C = [a,A];
>> B

B =

Columns 1 through 15

1 0 4 5 3 9 0 2 4 5 0 2 0 0 7

Column 16

1

>> C

C =

Columns 1 through 15

4 5 0 2 0 0 7 1 1 0 4 5 3 9 0

Column 16

2

>> D = zeros(1,50);%where 1 is number of rows and 50 no. of columns
>> D

D =

Columns 1 through 15

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Columns 16 through 30

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Columns 31 through 45

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Columns 46 through 50

0 0 0 0 0

>> E=ones(1,100);%where 1 is number of rows and 100 is number of columns
>> E

E =

Columns 1 through 15

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Columns 16 through 30

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Columns 31 through 45

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Columns 46 through 60

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Columns 61 through 75

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Columns 76 through 90

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Columns 91 through 100

1 1 1 1 1 1 1 1 1 1

%m:i:n generates a vector with intial value as m and further values by incrementing by i upto n

%In our case here starting from 1 incrementing by 1 creates a vector upto 30

>> F = 1:1:30

F =

Columns 1 through 15

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

Columns 16 through 30

16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

%incremente factor can be either positive or negative

%in the below case it is negative

>> G = 25:-3:1;
>> G

G =

25 22 19 16 13 10 7 4 1

>> H = 0:0.2:2;
>> H

H =

Columns 1 through 9

0 0.2000 0.4000 0.6000 0.8000 1.0000 1.2000 1.4000 1.6000

Columns 10 through 11

1.8000 2.0000

Please solve by using MATLAB thanks Creating vectors Generate the following vectors: A = [1 0 4 5 3 9 0 2] a = [4 5 0 2 0 0 7 1] Be aware that Matlab are case s
Please solve by using MATLAB thanks Creating vectors Generate the following vectors: A = [1 0 4 5 3 9 0 2] a = [4 5 0 2 0 0 7 1] Be aware that Matlab are case s
Please solve by using MATLAB thanks Creating vectors Generate the following vectors: A = [1 0 4 5 3 9 0 2] a = [4 5 0 2 0 0 7 1] Be aware that Matlab are case s

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site