Project

Coding Basics

1. A=[1,2,3,4,5] -> Creates a variable with the name A in a matrix dimension of 1*5

2. B=[1;2;3;4;5] -> Creates a variable with the name B in a matrix with dimension of 5*1 or transpose of A`

3. C = A*B` -> Syntax error, as the transposed of B(1*5) has the same matrix dimension of A (1*5), hence can\'t be multiplied

4. C = B*A -> Multiplication of two varible

Result = 1 2 3 4 5
2 4 6 8 10
3 6 9 12 15
4 8 12 16 20
5 10 15 20 25

5. A(1:end) -> Types the values of the variable A from the postion 1 in the matrix to the end of the matrix

Result = 1 2 3 4 5

6. A(1:2) -> Types the values fo the variable A from the postion 1 to 2 in the matrix in the matrix

Result = 1 2

7. B(1:2,3) -> Error: B(_,3): but B has size 5x1 = As the the matrix is in the dimension it can\'t fetch the non existant columns

8. B(length(B)-2) -> Gives the value 3rd position in the matrix, as it takes the length of the matrix and subtracts it by 2. The postion value is displayed

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.