__Let's take some examples:__

**Create a vector of the even whole numbers between 45 & 98.:**

to perform this operation use "

**:**" operatorX=[46:2:98];

**Compute the length of hypotenuse of a right triangle if the length of two other sides are given:**

We can calculate the hypotenuse of a right triangle using this formula

**C**^{2}=A^{2}+B^{2}A=input('enter the value of base ');

B=input('enter the value of perpendicular side ');

C=sqrt(A^2+B^2);

['length of hypotenuse']

disp(C)

__Concatenation of two matrices:__Suppose we have two matrices

**A**&**B**we can conctenat both matrices as follow-

C=[A B];

or

C=[A ; B];

__How to convert a number into a string:__use

**num2str(A)**to perform above operationconsider previous example of right triangle once again

A=input('enter the value of base ');

B=input('enter the value of perpendicular side ');

C=sqrt(A^2+B^2);

disp(['length of hypotenuse ',num2str(C)])

## No comments:

## Post a Comment