# Digital Signal And Processing

 Date 17.12.2020 Size 260.75 Kb. #55260
18-CP-84 DSP LAB1

## Digital Signal And Processing

LAB REPORT

Submitted to:

Sir Aamir Arslan

Submitted by:

18-CP-84 OMEGA

Multiply the following two matrices.

A = [1 2; 3 4]

## B = [5 6]

Code:

c=a.*b;

Running:

Solve the following system of linear equations.

𝒙𝟏+𝟐𝒙𝟐=𝟏

𝟐𝒙𝟏+𝟑𝒙𝟐=𝟏

You have to find the value of 𝒙𝟏 and 𝒙𝟐.

Code:

A=[1 2; 2 3];

B=[1;1]

X=inv(A)*B

Running:

Run the following code and explain the output.

x = 3; while (x < 8) disp ('Am I done yet?') x = x + 2.5; end

The following statement explain the “while loop”. It explains that loop will execute till value of x remains less than 8 and it will add 2.5 in original value of x. It will show “Am I done yet?” on the command window till the loop ends and loop will stop executing when the value of x exceed than 8 and the loop will terminate.

Write a MATLAB script that convert the length given in feet and inches into centimeters using the formula 1 inch=2.54 cm. Display the result on the screen.

Code:

x=5;

disp ('converting Ft into Cm')

FeetinCm=(x * 30.48);

disp(FeetinCm)

disp('Converting Inches into Cm')

InchesinCm=(x* 2.54);

disp(InchesinCm)

Running:

Write a MATLAB script to input two integer values and find out whether the first or the second number is greater.

Code:

A=input('Enter the first integer value :');

B=input('Enter the second integer value :');

disp('Maximum number is')

if (A>B)

disp(A)

else

disp(B)

end

Running:

Write a MATLAB script to calculate the sum of first 10 prime numbers

Code:

Ayra=10;

numbers=primes(Ayra);

disp('Sum of 10 prime no.s is ')

SUM=sum(numbers)

Running: