Experiment no. 1
Matrix operations
Aim :- Program on matrix operations to understand basic concept of
MATLAB.
Program :-
a=[ 2 3 5;6 4 2 ; 2 5 8]
b=[ 1 6 3; 8 6 4;3 9 1]
% for slection of colum
% selection of 2nd column from matrix "a"
c=a(:,2)
% for selection of row
% selection of 3rd row from matrix "a"
d=a(3,:)
% addition of two matrix
e=a+b
% subtraction of two matrix
% subtaction of a from b
f=b-a
% multiplicatation of two matrix
g=a*b
%division of two maytix a/b=a*b^-1
h=a/b
Experiment no. 2
Membership functions
Aim :- To print all the membership functions in MATLAB.
Triangular membership function :-
x=0:0.1:10;
y=trapmf(x,[3 6 6 8]);
plot(x,y)
xlabel('trimf, P=[3 6 8]')
Trapzoidal membership function :-
x=0:0.1:20;
y=trapmf(x,[5 10 14 18 ]);
plot(x,y)
axis([0 21 -0.1 1.1]);
Gaussian membership function :-
x=0:0.1:20;
y=gaussmf(x,[2 10]);
plot(x,y)
To print set of gaussion membership function :-
x=[0:0.1:20]';
y1=gauss2mf(x,[2 4 1 8]);
y2=gauss2mf(x,[2 5 1 7]);
y3=gauss2mf(x,[2 6 1 6]);
y4=gauss2mf(x,[2 7 1 5]);
plot(x,[y1,y2,y3,y4])
Gaussian bell membership function :-
x=0:0.1:20;
y=gbellmf(x,[4 6 12]);
plot(x,y)
Soft computing lab

Soft computing lab

  • 1.
    Experiment no. 1 Matrixoperations Aim :- Program on matrix operations to understand basic concept of MATLAB. Program :- a=[ 2 3 5;6 4 2 ; 2 5 8] b=[ 1 6 3; 8 6 4;3 9 1] % for slection of colum % selection of 2nd column from matrix "a" c=a(:,2) % for selection of row % selection of 3rd row from matrix "a" d=a(3,:) % addition of two matrix e=a+b % subtraction of two matrix % subtaction of a from b f=b-a % multiplicatation of two matrix g=a*b %division of two maytix a/b=a*b^-1 h=a/b
  • 3.
    Experiment no. 2 Membershipfunctions Aim :- To print all the membership functions in MATLAB. Triangular membership function :- x=0:0.1:10; y=trapmf(x,[3 6 6 8]); plot(x,y) xlabel('trimf, P=[3 6 8]')
  • 4.
    Trapzoidal membership function:- x=0:0.1:20; y=trapmf(x,[5 10 14 18 ]); plot(x,y) axis([0 21 -0.1 1.1]);
  • 5.
    Gaussian membership function:- x=0:0.1:20; y=gaussmf(x,[2 10]); plot(x,y)
  • 6.
    To print setof gaussion membership function :- x=[0:0.1:20]'; y1=gauss2mf(x,[2 4 1 8]); y2=gauss2mf(x,[2 5 1 7]); y3=gauss2mf(x,[2 6 1 6]); y4=gauss2mf(x,[2 7 1 5]); plot(x,[y1,y2,y3,y4])
  • 7.
    Gaussian bell membershipfunction :- x=0:0.1:20; y=gbellmf(x,[4 6 12]); plot(x,y)