Question

All these to be done in MATLAB: 1.1)Define a column vector, called “b” in MATLAB that...

All these to be done in MATLAB:

1.1)Define a column vector, called “b” in MATLAB that stored floating point numbers between 0.6 to 2.5 in increment of 0.2.

1.2)What is the size of vector b? How is the size of ‘b’ stored? Define number of rows of ‘b’ in variable ’row’ and number of columns of “b” in variable “col”.

1.3)Define matrix “A” as a 10 by 10 matrix of all “1”s.

1.4)Update matrix “A” as following: set all the elements of column 1 as 0.5, column 3 as -1, column 6 as (sin(b/2))^2, column 7 as b+log10(b), row8 as pi+cos(b), leave the rest as is.

1.5)Define matrix “B” as B=A’. How are “A” and “B” related?

1.6)Compute matrix product of A and B and store it in D.

1.7)Define variable “f” such that it stores all values in 5th row of matrix “D”, between columns 3 and10.

1.8)What is the array product of column 6 of A by vector b?

1.9)Define a 5*5 identity matrix using eye function in MATLAB. What happens if eye(5,3) is executed?

1.10)Define a 5*5 and 5*4 matrix using zeros function in MATLAB.

Homework Answers

Answer #1

Ans

code:-

%1.1)

b=[0.6:0.2:2.5]'

%1.2

[row,col]=size(b)

%1.3

A=ones(10)

%1.4

A(:,1)=0.5;

A(:,3)=-1;

A(:,6)=sin(b./2).^2;

A(:,7)=b+log10(b);

A(8,:)=pi+cos(b);

A

%1.5

B=A'

%B is transpose of A

%1.6

D=A*B

%1.7

f=D(5,3:10);

%1.8

A(:,6).*b

%1.9

%creates 5x5 identity matrix

eye(5)

eye(5,3)%create first 3 column of 5x5 identity matrix

%1.10

zeros(5)

zeros(5,4)

output:-

b=

0.6000

0.8000

1.0000

1.2000

1.4000

1.6000

1.8000

2.0000

2.2000

2.4000

row =

10

col =

1

A =

Columns 1 through 6

1 1 1 1 1 1

1 1 1 1 1 1

1 1 1 1 1 1

1 1 1 1 1 1

1 1 1 1 1 1

1 1 1 1 1 1

1 1 1 1 1 1

1 1 1 1 1 1

1 1 1 1 1 1

1 1 1 1 1 1

Columns 7 through 10

1 1 1 1

1 1 1 1

1 1 1 1

1 1 1 1

1 1 1 1

1 1 1 1

1 1 1 1

1 1 1 1

1 1 1 1

1 1 1 1

A =

Columns 1 through 3

0.5000 1.0000 -1.0000

0.5000 1.0000 -1.0000

0.5000 1.0000 -1.0000

0.5000 1.0000 -1.0000

0.5000 1.0000 -1.0000

0.5000 1.0000 -1.0000

0.5000 1.0000 -1.0000

3.9669 3.8383 3.6819

0.5000 1.0000 -1.0000

0.5000 1.0000 -1.0000

Columns 4 through 6

1.0000 1.0000 0.0873

1.0000 1.0000 0.1516

1.0000 1.0000 0.2298

1.0000 1.0000 0.3188

1.0000 1.0000 0.4150

1.0000 1.0000 0.5146

1.0000 1.0000 0.6136

3.5040 3.3116 3.1124

1.0000 1.0000 0.7943

1.0000 1.0000 0.8687

Columns 7 through 9

0.3782 1.0000 1.0000

0.7031 1.0000 1.0000

1.0000 1.0000 1.0000

1.2792 1.0000 1.0000

1.5461 1.0000 1.0000

1.8041 1.0000 1.0000

2.0553 1.0000 1.0000

2.9144 2.7254 2.5531

2.5424 1.0000 1.0000

2.7802 1.0000 1.0000

Column 10

1.0000

1.0000

1.0000

1.0000

1.0000

1.0000

1.0000

2.4042

1.0000

1.0000

B =

Columns 1 through 3

0.5000 0.5000 0.5000

1.0000 1.0000 1.0000

-1.0000 -1.0000 -1.0000

1.0000 1.0000 1.0000

1.0000 1.0000 1.0000

0.0873 0.1516 0.2298

0.3782 0.7031 1.0000

1.0000 1.0000 1.0000

1.0000 1.0000 1.0000

1.0000 1.0000 1.0000

Columns 4 through 6

0.5000 0.5000 0.5000

1.0000 1.0000 1.0000

-1.0000 -1.0000 -1.0000

1.0000 1.0000 1.0000

1.0000 1.0000 1.0000

0.3188 0.4150 0.5146

1.2792 1.5461 1.8041

1.0000 1.0000 1.0000

1.0000 1.0000 1.0000

1.0000 1.0000 1.0000

Columns 7 through 9

0.5000 3.9669 0.5000

1.0000 3.8383 1.0000

-1.0000 3.6819 -1.0000

1.0000 3.5040 1.0000

1.0000 3.3116 1.0000

0.6136 3.1124 0.7943

2.0553 2.9144 2.5424

1.0000 2.7254 1.0000

1.0000 2.5531 1.0000

1.0000 2.4042 1.0000

Column 10

0.5000

1.0000

-1.0000

1.0000

1.0000

0.8687

2.7802

1.0000

1.0000

1.0000

D =

Columns 1 through 3

7.4006 7.5291 7.6482

7.5291 7.7673 7.9879

7.6482 7.9879 8.3028

7.7616 8.1977 8.6025

7.8709 8.4000 8.8915

7.9772 8.5965 9.1724

8.0808 8.7881 9.4463

18.0120 19.1592 20.2679

8.2808 9.1580 9.9750

8.3772 9.3365 10.2299

Columns 4 through 6

7.7616 7.8709 7.9772

8.1977 8.4000 8.5965

8.6025 8.8915 9.1724

8.9880 9.3601 9.7219

9.3601 9.8128 10.2530

9.7219 10.2530 10.7697

10.0747 10.6824 11.2737

21.3584 22.4358 23.4977

10.7554 11.5105 12.2456

11.0834 11.9091 12.7129

Columns 7 through 9

8.0808 18.0120 8.2808

8.7881 19.1592 9.1580

9.4463 20.2679 9.9750

10.0747 21.3584 10.7554

10.6824 22.4358 11.5105

11.2737 23.4977 12.2456

11.8507 24.5377 12.9627

24.5377 105.1767 26.5197

12.9627 26.5197 14.3447

13.4971 27.4445 15.0084

Column 10

8.3772

9.3365

10.2299

11.0834

11.9091

12.7129

13.4971

27.4445

15.0084

15.7342

ans =

0.0524

0.1213

0.2298

0.3826

0.5810

0.8234

1.1045

6.2248

1.7474

2.0849

ans =

1 0 0 0 0

0 1 0 0 0

0 0 1 0 0

0 0 0 1 0

0 0 0 0 1

ans =

1 0 0

0 1 0

0 0 1

0 0 0

0 0 0

ans =

0 0 0 0 0

0 0 0 0 0

0 0 0 0 0

0 0 0 0 0

0 0 0 0 0

ans =

0 0 0 0

0 0 0 0

0 0 0 0

0 0 0 0

0 0 0 0

If any doubt ask in the comments.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Answer all of the questions true or false: 1. a) If one row in an echelon...
Answer all of the questions true or false: 1. a) If one row in an echelon form for an augmented matrix is [0 0 5 0 0] b) A vector b is a linear combination of the columns of a matrix A if and only if the equation Ax=b has at least one solution. c) The solution set of b is the set of all vectors of the form u = + p + vh where vh is any solution...
Recall that if A is an m × n matrix and B is a p ×...
Recall that if A is an m × n matrix and B is a p × q matrix, then the product C = AB is defined if and only if n = p, in which case C is an m × q matrix. (a) Write a function M-file that takes as input two matrices A and B, and as output produces the product by columns of the two matrix. For instance, if A is 3 × 4 and B is...
Please use Mat lab only. Thanks (b) Plotting Sunspots Load the Matlab data file, sunspot.dat, and...
Please use Mat lab only. Thanks (b) Plotting Sunspots Load the Matlab data file, sunspot.dat, and experiment with making plots and subplots. The file is a simple 288 row by 2 column matrix where the first column has consecutive years from 1700 until 1987 and the second column has the mean sunspot number for that year. Then we will construct year and spots vectors from the two columns and plot spots as a function of year. load sunspot.dat; year =...
In R studio please explain how to do the stemplot? A sample of 20 endangered species...
In R studio please explain how to do the stemplot? A sample of 20 endangered species was obtained and the length of time (in months) since being placed on the list was recorded for each species. A stemplot of these data follows. In the stemplot, 5|2 represents 52 months. 5   2 4 8 9 9 6   0 0 3 5 6 7 8 9 7   3 4 7 8 9 9 8 9   8 The median length of time (in...
Assume that we are working with an aluminum alloy (k = 180 W/moC) triangular fin with...
Assume that we are working with an aluminum alloy (k = 180 W/moC) triangular fin with a length, L = 5 cm, base thickness, b = 1 cm, a very large width, w = 1 m. The base of the fin is maintained at a temperature of T0 = 200oC (at the left boundary node). The fin is losing heat to the surrounding air/medium at T? = 25oC with a heat transfer coefficient of h = 15 W/m2oC. Using the...
Prosperity Land Ltd (PLL) is a commercial property developer. It designs and builds malls for customers...
Prosperity Land Ltd (PLL) is a commercial property developer. It designs and builds malls for customers to operate their businesses. Instead of renting the space to the customers, PLL sells the units to them under Strata Title. PLL needs to determine the right selling prices which allows it to maximise profit while attracting many buyers. This assignment requires you to practise principles of correct spreadsheet construction and design to help PLL to improve its decision making to meet its business...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT