0% found this document useful (0 votes)
45 views13 pages

Digital Image Processing

This document contains code for performing various operations on fuzzy sets, including: - Union, intersection, and complement of two fuzzy sets - Finding the difference between two fuzzy sets - Implementing the Max-Min and Max-Product operations on two fuzzy sets - Performing a lambda cut on a fuzzy set and fuzzy matrix - Calculating the inner product and outer product of two fuzzy sets

Uploaded by

PardeepJhandi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views13 pages

Digital Image Processing

This document contains code for performing various operations on fuzzy sets, including: - Union, intersection, and complement of two fuzzy sets - Finding the difference between two fuzzy sets - Implementing the Max-Min and Max-Product operations on two fuzzy sets - Performing a lambda cut on a fuzzy set and fuzzy matrix - Calculating the inner product and outer product of two fuzzy sets

Uploaded by

PardeepJhandi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

CHANDIGARH UNIVERSITY

Experiment-1(a)

Objective -: To perform intersection union and compliment on fuzzy sets.

% Raghav Chadha program 14/01/2016 %


u=input('Insert the first matrix');
v=input('Insert the second matrix');
option=input('1 for union , 2 for intersection , 3 for compliment');
if(option==1)
p=max(u,v)
end
if(option==2)
g=min(u,v)
end
if(option==3)
option1=input('1 for compliment of u , 2 for compliment of v');
if(option1==1)
[a,b]=size(u);
a
b
r=ones(a,b)-u
else
[a,b]=size(v);
a
b
r=ones(a,b)-v
end
end

CHANDIGARH UNIVERSITY

CHANDIGARH UNIVERSITY

CHANDIGARH UNIVERSITY

Experiment-1 (b)
Objective -: To find out difference between two fuzzy sets.

% Raghav Chadha 25/01/2016 %

u=input('enter the 1st matrix');


v=input('enter the 2nd matrix');
option=input('etnter 1 for u-v, enter 2 for v-u');
if(option==1)
[a,b]=size(v);
a
b
v=ones(a,b)-v
p=min(u,v)
else
[a,b]=size(u);
a
b
u=ones(a,b)-u
p=min(v,u)
end

CHANDIGARH UNIVERSITY

CHANDIGARH UNIVERSITY
PRACTICAL 9
AIM To implement MaxMin and MaxProduct of two fuzzy sets.
MAX-MIN:
u=input('Enter first fuzzy set: ')
v=input('Enter second fuzzy set: ')
[ru cu]=size(u);
[rv cv]=size(v);
r=zeros(ru,cv);
disp('Result: ');
if cu==rv
for i=1:ru
for k=1:cv
d=0;
for j=1:cu
m=min(u(i,j),v(j,k));
if m>=d
d=m;
end
end
r(i,k)=d;
end
end
disp(r)
else
disp('Error in fuzzy set order')
end

CHANDIGARH UNIVERSITY

OUTPUT:

CHANDIGARH UNIVERSITY

MAX-PRODUCT:
u=input('Enter first fuzzy set: ')
v=input('Enter second fuzzy set: ')
[ru cu]=size(u);
[rv cv]=size(v);
r=zeros(ru,cv);
disp('Result: ');
if cu==rv
for i=1:ru
for k=1:cv
d=0;
for j=1:cu
m=(u(i,j)*v(j,k));
if m>=d
d=m;
end
end
r(i,k)=d;
end
end
disp(r)
else
disp('Error in fuzzy set order')
end

CHANDIGARH UNIVERSITY
OUTPUT:

CHANDIGARH UNIVERSITY
PRACTICAL 10
AIM
a) To implement lambda cut on a fuzzy set.
u=input('Enter set: ')
lambda=input('Enter Lambda Cut: ')
[row,col]=size(u);
m=0;
v=[];
for i=1:col
if u(1,i)>=lambda
m=m+1;
v=[v,i];
else
continue;
end
end
display(v)

OUTPUT:

CHANDIGARH UNIVERSITY

b) To implement lambda cut on a fuzzy matrix.


u=input('Enter matrix: ')
lambda=input('Enter Lambda Cut: ')
[row,col]=size(u);
v=zeros(row,col);
for i=1:row
for j=1:col
if u(i,j)>=lambda
v(i,j)=1;
else
v(i,j)=0;
end
end
end
display(v)

OUTPUT:

CHANDIGARH UNIVERSITY
PRACTICAL 11
AIM To implement InnerProduct and Outer Product of fuzzy sets.
u=input('Enter First Set: ')
v=input('Enter Second Set: ')
[row1,col1]=size(u);
[row2,col2]=size(v);
if col1==col2
r=zeros(row1,col1);
%INNER PRODUCT%
for i=1:col1
r(1,i)=min(u(1,i),v(1,i));
InnerProduct=max(r);
end
s=zeros(row1,col1);
%OUTER PRODUCT%
for i=1:col1
s(1,i)=max(u(1,i),v(1,i));
OuterProduct=min(s);
end
display(InnerProduct)
display(OuterProduct)
else
display('error')
end

OUTPUT:

CHANDIGARH UNIVERSITY

You might also like