Sunteți pe pagina 1din 14

DSAA

Assignment 3
REPORT
Nancy
201303010
Question 1.

0.1
0
-0.1

7
4

x 10

0.1
0
-0.1

10

12
4

x 10

0.1
0
-0.1

10

12
4

x 10

The graph shows :


1. Plot of training sound
2. Plot of synthesized sound from training sound without k means after idft
3. Plot of synthesized sound after k means and idft
In the training stage:
We first read the sound and make it mono if stereo
The frame size is 20msec as mentioned
We then compute the dft for each 20msec sample

In the testing Stage :


We compute the dfts for 20msec samples for the test file. Initially ctrs are the k mean vectors which
we calculated .Now here for each sample of 20 msec which we have as a complex vector of
length 512, we will find which of the means in ctrs is closest to this
vector and thus make a new set of dft using those means.
Now we will apply idft on the test dft and the dft made using the k means
on the test dft.
Question 2.
All the signals have been plotted as shown below and run the program for sounds.

Sin Of Freq 200Hz

1
0.8
0.6
0.4
0.2
0
-0.2
-0.4
-0.6
-0.8
-1

0.2

0.4

0.6

0.8

1.2

1.4

1.6

1.8

2
4

x 10

fft of sin 200hz

12000

10000

8000

6000

4000

2000

0.2

0.4

0.6

0.8

1.2

1.4

1.6

1.8

2
4

x 10
Cos Of Freq 1000Hz

1
0.8
0.6
0.4
0.2
0
-0.2
-0.4
-0.6
-0.8
-1

0.2

0.4

0.6

0.8

1.2

1.4

1.6

1.8

2
4

x 10

fft

10000
9000
8000
7000
6000
5000
4000
3000
2000
1000
0

0.2

0.4

0.6

0.8

1.2

1.4

1.6

1.8

2
4

x 10
Cophasic Addition with Cos of 1000Hz

1.5

Values

0.5

-0.5

-1

-1.5

0.2

0.4

0.6

0.8

1
time

1.2

1.4

1.6

1.8

2
4

x 10

FFT of Cophasic Addition with Cos of 1000Hz

12000

10000

8000

6000

4000

2000

0.2

0.4

0.6

0.8

1.2

1.4

1.6

1.8

2
4

x 10
Cophasic Addition with Cos of 1000Hz

1.5

Values

0.5

-0.5

-1

-1.5

0.2

0.4

0.6

0.8

1
time

1.2

1.4

1.6

1.8

2
4

x 10

FFT of Cophasic Addition with Cos of 2000Hz

12000

10000

8000

6000

4000

2000

0.2

0.4

0.6

0.8

1.2

1.4

1.6

1.8

2
4

x 10
Cophasic Addition with Cos of 1000Hz

1.5

Values

0.5

-0.5

-1

-1.5

0.2

0.4

0.6

0.8

1
time

1.2

1.4

1.6

1.8

2
4

x 10

FFT of Cophasic Addition with Cos of 10000Hz

12000

10000

8000

6000

4000

2000

0.2

0.4

0.6

0.8

1.2

1.4

1.6

1.8

2
4

x 10
Antiphasic Addition with Cos of 1000Hz

1.5

Values

0.5

-0.5

-1

-1.5

0.2

0.4

0.6

0.8

1
time

1.2

1.4

1.6

1.8

2
4

x 10

FFT of Antiphasic Addition with Cos of 1000Hz

12000

10000

8000

6000

4000

2000

0.2

0.4

0.6

0.8

1.2

1.4

1.6

1.8

2
4

x 10
Antiphasic Addition with Cos of 2000Hz

1.5

Values

0.5

-0.5

-1

-1.5

0.2

0.4

0.6

0.8

1
time

1.2

1.4

1.6

1.8

2
4

x 10

FFT of Antiphasic Addition with Cos of 10000Hz

12000

10000

8000

6000

4000

2000

0.2

0.4

0.6

0.8

1.2

1.4

1.6

1.8

2
4

x 10
Antiphasic Addition with Cos of 10000Hz

1.5

Values

0.5

-0.5

-1

-1.5

0.2

0.4

0.6

0.8

1
time

1.2

1.4

1.6

1.8

2
4

x 10

FFT of Antiphasic Addition with Cos of 10000Hz

12000

10000

8000

6000

4000

2000

0.2

0.4

0.6

0.8

1.2

1.4

1.6

1.8

2
4

x 10

Question 3.
In this question we are trying to predict the temperatures of the next 10 days and we are given the
data of Jan 1st - May 3rd, 2011 by using Linear Prediction (LPC). For this we have
used lpc() to get coefficients and then filter() to get estimated values in an
array.
The predicted values are :
44.0305, 45.0673, 45.2529, 45.9068, 46.2702, 47.0061, 47.2853, 47.9678, 48.1061, 48.8607
Question 4.
In this question we have been asked to compress the given greyscale images.
Steps:
1 I have taken an image and read it as Greyscale image and then I have performed dct ()
function row by row on the 2-D matrix that come out on reading the image as Greyscale.
After that I have performed ci2 ci4 etc. and idct (), that is the inverse dct function, to
reconstruct the compressed images.
The above things I have done on firstly the 1D compression and the output are:
IMAGE 1:
Original Image

Compression Factor 2

50

50

100

100

150

150
50

100 150 200 250

50

Compression Factor 4

Compression Factor 8

50

50

100

100

150

150
50

100 150 200 250

100 150 200 250

50

100 150 200 250

Original Image

Compression Factor 2 * 2

50

50

100

100

150

150
50

100 150 200 250

50

Compression Factor 4 * 4

Compression Factor 8 * 8

50

50

100

100

150

150
50

100 150 200 250

100 150 200 250

50

100 150 200 250

IMAGE 2 :
Original Image

Compression Factor 2

200

200

400

400

600

100

200

300

400

500

600

Compression Factor 4

200

400

400

100

200

300

400

200

300

400

500

Compression Factor 8

200

600

100

500

600

100

200

300

400

500

Original Image

Compression Factor 2 * 2

200

200

400

400

600

100

200

300

400

500

600

Compression Factor 4 * 4

200

400

400

100

200

300

400

200

300

400

500

600

100

200

300

400

IMAGE 3 :
Original Image

Compression Factor 2

100

100

200

200

300

300

400

400
100

200

300

400

100

Compression Factor 4
100

200

200

300

300

400

400
200

300

400

200

300

400

Compression Factor 8

100

100

500

Compression Factor 8 * 8

200

600

100

100

200

300

400

500

Original Image

Compression Factor 2 * 2

100

100

200

200

300

300

400

400
100

200

300

400

100

Compression Factor 4 * 4
100

200

200

300

300

400

400
200

300

400

300

400

Compression Factor 8 * 8

100

100

200

100

200

300

400

The first one is for the 1D compression with the factors given and the second one is for 2D
compression.
ERMS Matrix values goes on increasing as compression factor increases and image becomes more
blurred.

S-ar putea să vă placă și