Project

coding basics

1. A=[ 1,2,3,4,5]-This means numbers-1,2,3,4,5 are saved in an array-\'A\' variable. Array:1-row X 5-columns.

2.B=[1;2;3;4;5]- This means numbers will be saved in an array-\'B\'. Array: 5-rows X 1-column.

3. C=A*B\'. This wont work because B\' is B transpose which will change B into 1X5 matrix. And we cannot multiply two 1X5 matrices.

4.C=B*A. This will create a new matrix of 5 rows and 5 columns i.e 5X5 matrix. Numbers will be the matrix product of numbers saved in B and A.

5. A(1:end) This will display all numbers in array A.

6.A(1:2) This will display numbers saved in Array A at positions- (1,1) and (1,2)

7.B(1:2,3) This wont be possible as in the given command, as there is only one column.

8. B(length(B)-2)- This will work. First it will calculate no. of numbers in B which is length(B). Followed by subtracting 2 from it which will be B(3). Then it will display number which is at B(3)

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.