Professional Documents
Culture Documents
in MATLAB
Image Processing in
MATLAB
clc
clear all
close all
% Reading of an image
i=imread('cameraman.tif’); % path of image
% Showing of an image
figure(1),imshow(i)
% Read the saved image and give title as “Write Image with PNG
format”
B=imread('test.png');
figure, imshow(B),title('Write Image with png format');
% Basic Thresholding
I1=I>120;
figure, imshow(I1),title('Simple Image Thresholding');
%% Contrast Increase
%Id1=I+100;
Id1=imadd(I,100); %can use this command also for the previous
statement
figure,imshow(Id1),title('Contrast Increase');
%% Contrast Decrease
%Id2=Id-50;can use this command also for the next statement
Id2=imsubtract(I,50);
figure,imshow(Id2),title('Contrast decrease');
%% Image Multiply
Im=immultiply(I,0.5);
figure,imshow(Im), title('Image multiplied by 0.5');
%% Image Divide
Im1=imdivide(I,0.5);
figure,imshow(Im1),title('Image divided by 0.5');
Biomedical Signal
Processing in
MATLAB
1. Go to standard database website
https://archive.physionet.org/cgi-bin/atm/ATM
2. Download the data and save the values in the excel file
clc
clear all
close all
play(p)
stop(p)
• Write in Editor window and add the delay in audio file which produces Echo
play(p1)
stop(p1)
Generation of Music
“SAREGAMA” in
MATLAB
clc
clear all
close all
A=3;
N=2;
t=(0:0.001:N*8);
f=100;
sa=1/2*sin(2*pi*f*t);
re=1/2*sin(2*pi*f*t*9/8);
ga=1/2*sin(2*pi*f*t*5/4);
ma=1/2*sin(2*pi*f*t*4/3);
pa=1/2*sin(2*pi*f*t*3/2);
dha=1/2*sin(2*pi*f*t*5/3);
ni=1/2*sin(2*pi*f*t*15/8);
Sa=1/2*sin(2*pi*f*t*2);
Re=1/2*sin(2*pi*f*t*2*9/8);
Ga=1/2*sin(2*pi*f*t*2*5/4);
Ma=1/2*sin(2*pi*f*t*2*4/3);
Pa=1/2*sin(2*pi*f*t*2*3/2);
Dha=1/2*sin(2*pi*f*t*2*5/3);
Ni=1/2*sin(2*pi*f*t*2*15/8);
s=[sa re ga ma pa dha ni Sa];
b=fliplr(s);
s1=[sa re ga ma pa dha ni Sa b];
%sound(s1);
if strcmp(A,'sa')
sound(sa);
elseif strcmp(A,'re')
sound(re);
elseif strcmp(A,'ga')
sound(ga);
elseif strcmp(A,'ma')
sound(ma);
elseif strcmp(A,'pa')
sound(pa);
elseif strcmp(A,'dha')
sound(dha);
elseif strcmp(A,'ni')
sound(ni);
elseif strcmp(A,'Sa')
sound(Sa);
elseif strcmp(A,'sargam')
sound(s1);
elseif strcmp(A,'Re')
sound(Re);
elseif strcmp(A,'Ga')
sound(Ga);
elseif strcmp(A,'Ma')
sound(Ma);
elseif strcmp(A,'Pa')
sound(Pa);
elseif strcmp(A,'Dha')
sound(Dha);
elseif strcmp(A,'Ni')
sound(Ni);
elseif strcmp(A,'s1')
sound(s1)
end
end
• Write in Command window to play the audio “SA RE GA MA”
Sound(s1)