100% Guaranteed Results


21AIE315 – LABSHEET 1 Solved
$ 29.99
Category:

Description

5/5 – (1 vote)

Introduction to MATLAB

Deepak Yadav

%Reading audio file and printing the waveform

[y,Fs] = audioread(‘Moscow.mp3’);
%sound(y,Fs); size(‘Moscow.mp3’);
length(y) whos y; whos Fs;
TotalTime = length(y)./Fs;
t = 0:TotalTime/(length(y)):TotalTime-TotalTime/length(y); plot(t,y)

%Output

1. Type the following commands and observe closely what happens after each instruction.
a. help sqrt ans)

b. x = sqrt(4) ans)

c. Y = sqrt(9); ans)

d. who ans)

e. whos ans)

f. Z = sin(3.14) ans)

g. whos ans)

h. clc ans) screen gets cleared but the variables are stored at it is.

i. who ans)

j. clear ans) Screen gets clear as well as all the variables stored.

k. who ans) Nothing gets printed, as all the stored variables are erased by command
‘clear’

l. size(x) ans)

m. a = [1 2 3] b = [3 4 5]

o. zeros(4) ans)

ans)

s. P = [zeros(3,1) 1 1 ones(1,2)] ans) Since during horizontal concatenation rows of both matrix should be same.

t. Y = 1 : 0.5 : 5 ans)

u. M = [1 2 3
4 5 6
7 8 9 ] ans)

fprintf(‘%f ’, M);

2. A matrix is given as below
a. Generate the matrix in MATLAB using the 4 different methods mentioned in this document.

Method 2:

Method 4:

c. Use size command to find out the size of the matrix ans)

d. Extract the second row of A into a vector X and third column of A into a vector Y. ans)

e. Multiply the matrices X and Y ans)

f. Multiply the matrices X and Y element by element. ans)

g. Replace the last row by the vector [1 5 9 0] ans)

h. Print the elements of the matrix in one row, in one column. ans)

i. Print the elements of the matrix in the reverse order.
ans)

j. Extract the diagonal elements of A in to a vector D. ans)

k. Create a diagonal matrix V with the extracted diagonal elements. ans)

l. Create an identity matrix of the same size as V ans)

m. Concatenate the diagonal matrix with the identity matrix and create a new matrix of double the size. ans)

3. Create a vector with the first element zero and last element one, with each element being separated by 0.01. Find the length of the vector that you created. ans)

4. Create vectors x = [1 6 9 2] and y = [2 0 3 8]. Find the element wise sum and product of x and y.

5. Use the command who and whos. What is the difference between these two?
ans)who : lists the variables currently in the workspace. whos : lists the current variables and their sizes and types. It also reports the totals for sizes.

6. Find the sum, mean and median of all elements of the Matrix U=[4 5 6 7] ans)

Median

Reviews

There are no reviews yet.

Be the first to review “21AIE315 – LABSHEET 1 Solved”

Your email address will not be published. Required fields are marked *

Related products