Digital Signal And Processing



Download 260.75 Kb.
Date17.12.2020
Size260.75 Kb.



Digital Signal And Processing


LAB REPORT



Submitted to:

Sir Aamir Arslan

Submitted by:

Ayrass Muhammad

18-CP-84 OMEGA

Task #1

Multiply the following two matrices.

A = [1 2; 3 4]

B = [5 6]


Code:

c=a.*b;


Running:


Task #2


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:


Task #3


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.






Task #4


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:


Task #5


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:





Task #6


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:




Download 260.75 Kb.

Share with your friends:




The database is protected by copyright ©ininet.org 2020
send message

    Main page