Professional Documents
Culture Documents
Lab Report#1 DSP
Lab Report#1 DSP
matlab figure.
a) f(x) = e(x/10) + x0.3 for x = [0 20] with step size = 0.01
MATLAB CODE
clear all
close all
x=0:0.01:20;
f= exp(x/10)+ x.^(0.3);
%Continuous Plot
subplot(2,1,1);
plot(x,f);
title('Continuous Plot of f(x)= exp(x/10)+x^(0.3)');
xlabel('x-axis');
ylabel('y-axis');
%Discrete Plot
subplot(2,1,2);
stem(x,f);
title('Discrete Plot of f(x)= exp(x/10)+x^(0.3)');
xlabel('x-axis');
ylabel('y-axis');
Output
b) f(t) =(sin(2 πt) + 2 for t = [0 2π] with step size = 0 .1 π
MATLAB CODE:
clear all
close all
t=0:0.1*pi:2*pi;
f= (sin(2*pi*t))+2;
%Continuous Plot
subplot(2,1,1);
plot(t,f);
title('Continuous Plot of f= (sin(2*pi*t))+2');
xlabel('t-axis');
ylabel('y-axis');
%Discrete Plot
subplot(2,1,2);
stem(t,f);
title('Discrete Plot of f= (sin(2*pi*t))+2');
xlabel('t-axis');
ylabel('y-axis');
OUTPUT:
c) f(x) = a0 + (an cos(nπx/L)+ bn sin(nπx/L) with step size = 0.2 and an = 4,
bn = 2, n = 0.2, L = 10, and x = [0 10]
MATLAB CODE:
clear all
close all
x=0:0.2:10;
an = 4;bn =2; n = 0.2; L = 10;ao=1;
f= ao+(an*cos((n*pi*x)/L)+bn*sin((n*pi*x)/L));
%Continuous Plot
subplot(2,1,1);
plot(x,f);
title('Continuous Plot of f= ao+(an*cos((n*pi*x)/L)+bn*sin((n*pi*x)/L))');
xlabel('x-axis');
ylabel('y-axis');
%Discrete Plot
subplot(2,1,2);
stem(x,f);
title('Discrete Plot of f= ao+(an*cos((n*pi*x)/L)+bn*sin((n*pi*x)/L))');
xlabel('x-axis');
ylabel('y-axis');
OUTPUT
Task # 2. Create a zero matrix “A” with dimension 5 X 5, substitute value 5
at all diagonal position of the same matrix, by accessing matrix index
positions.
MATLAB CODE:
clc
clear all
close all
A=zeros(5,5);
A(1,1)=5;
A(2,2)=5;
A(3,3)=5;
A(4,4)=5;
A(5,5)=5;
display(A)
Output:
Task # 3. Matrix A = [3 4 5 : 8 7 6 : 9 10 6] B = [6 9 3 : 6 1 4 : 2 0 8]
a) Calculate R = (A X B), show the dimension and data type of each matrix
in the workspace
MATLAB CODE:
A=[3 4 5; 8 7 6; 9 10 6];
B=[6 9 3; 6 1 4; 2 0 8];
R=A*B;
Whos;
OUTPUT:
b) Calculate R = A+B
MATLAB Code:
A=[3 4 5; 8 7 6; 9 10 6];
B=[6 9 3; 6 1 4; 2 0 8];
R=A+B
Output:
c) Calculate R = A-B
MATLAB Code:
A=[3 4 5; 8 7 6; 9 10 6];
B=[6 9 3; 6 1 4; 2 0 8];
R=A-B
Output:
d) Substitute value 1000 at 3rd row and 2nd column position of matrix A.
MATLAB Code:
A=[3 4 5; 8 7 6; 9 10 6];
A(3,2)=1000
Output:
Task # 4. Create a “sin(2 πft)” wave in continuous domain with any smallest
step size of your choice, use frequency “ f ” = 2 Hz, using different sampling
rate to show the effect of aliasing. Plot all signals through subplot in the
figure.
TASK 4:
MATLAB Code:
f=2;
t=[0:0.1*pi:4*pi];
y=sin(2*pi*f*t);
subplot(2,2,1)
plot(t,y)
y=sin(3*pi*f*t);
subplot(2,2,2)
plot(t,y)
y=sin(4*pi*f*t);
subplot(2,2,3)
plot(t,y)
y=sin(5*pi*f*t);
subplot(2,2,4)
plot(t,y)
Output:
Task # 5. Read any .png, jpeg, or .tiff formatted image from your directory
and display the same image in gray scale, also show the pixel histogram of
the image.
MATLAB CODE
clear all
close all
I=imread('arduio.jpg');
subplot(3,1,1);
imshow(I);
G=rgb2gray(I);
subplot(3,1,2);
imshow(G);
subplot(3,1,3);
imhist(G);
OUTPUT:
Task # 6. Read an image from your directory and resize the same image
into half of the original size. Also display the result.
MATLAB CODE
clear all
close all
I=imread('arduio.jpg');
figure
imshow(I);
G=imresize(I,0.5);
figure
imshow(G);
OUTPUT
Task # 7. Read and image from your directory, convert the image into gray-
scale, then modify the pixel values in such a way that the left half portion of
the image get black. Also display the result.
MATLAB CODE
clear all
close all
I=imread('arduio.jpg');
subplot(1,2,1);
imshow(I);
G=rgb2gray(I);
G(1:440,1:400)=0;
subplot(1,2,2);
imshow(G);
OUTPUT:
Task # 8. Attach the snap-shot to prove that you have installed the latex on
your PC.
Task # 9. Write in your own word:
a) What is the image local texture features, List about 10 different texture
features available for image texture description.
An image texture is a set of metrics calculated in image processing designed to quantify the
perceived texture of an image. Image texture gives us information about the spatial arrangement
of color or intensities in an image or selected region of an image.
Texture feature is an important low level feature in the image, it can be used to describe the
contents of an image or a region in additional to colour features as colour features are not
sufficient to identify the image since different images may have similar histograms. Several
methods can be used to describe the main features of the textures such as coarseness and
regularity. Gray-Level Cooccurrence matrices measure is one of the most important measures
that can be used to describe the texture, for more clarification, consider the trees leaves and the
grass, both may give the same colour histogram but we can differentiate between them by using
the texture features such as smoothness and coarseness.
Following is the list of 10 different texture features of image description.
Edge Detection
Co-occurrence Matrix
Laws Texture Energy Measures
Autocorrelation and Power Spectrum
Texture Segmentation
Illumination (gray scale) invariance
spatial scale invariance
rotation invariance
Projection invariance
Window/sample size
b) Confusion matrix is used for feature classification, write in your own
words, and also show me some examples of confusion matrix used in the
image processing research papers.
Confusion Matrix
A confusion matrix (or error matrix) is usually used as the quantitative method of
characterizing image classification accuracy. It is a table that shows correspondence between
the classification result and a reference image. I.e., to create the confusion matrix we need the
ground truth data, such as cartographic information, results of manually digitizing an image.
CONFUSION MATRIX IN IMAGE PROCESSING RESEARCH PAPER
It was of interest in the present study to compare two models selected from a class of finite-
state models with the choice model (Luce, 1963a). and a "threshold" finite-state model with
models postulating sensory confusion. The class of finite-state models from which the two
representatives were selected was motivated by the simple finite-state models used in some
detection experiments (Atkinson & Kinchla, 1965; Kinchla, Townsend. Yellott, & Atkinson.
1966) and multisymbol recognition situations (Townsend, 1966). In order to provide continuity
with the intuitions and structure developed earlier. we will refer 10 the finite class of models
as the general activation model.
Task # 10. Attach snapshot to show me that you can download any recently
published research paper from “Google scholar”, Note only post a snap shot
that show that you have downloaded any image processing research paper
from Google scholar.