Embed presentation
![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](https://image.slidesharecdn.com/softlab2-211110180535/85/Soft-computing-lab-1-320.jpg)

![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]')](https://image.slidesharecdn.com/softlab2-211110180535/85/Soft-computing-lab-3-320.jpg)
![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]);](https://image.slidesharecdn.com/softlab2-211110180535/85/Soft-computing-lab-4-320.jpg)
![Gaussian membership function :-
x=0:0.1:20;
y=gaussmf(x,[2 10]);
plot(x,y)](https://image.slidesharecdn.com/softlab2-211110180535/85/Soft-computing-lab-5-320.jpg)
![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])](https://image.slidesharecdn.com/softlab2-211110180535/85/Soft-computing-lab-6-320.jpg)
![Gaussian bell membership function :-
x=0:0.1:20;
y=gbellmf(x,[4 6 12]);
plot(x,y)](https://image.slidesharecdn.com/softlab2-211110180535/85/Soft-computing-lab-7-320.jpg)

The document describes two experiments in MATLAB. The first experiment performs various matrix operations like selecting columns and rows, adding, subtracting, multiplying and dividing matrices. The second experiment prints different types of membership functions in MATLAB including triangular, trapezoidal, Gaussian, multiple Gaussian and Gaussian bell membership functions. It generates sample x and y values and plots the membership functions.
![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](https://image.slidesharecdn.com/softlab2-211110180535/85/Soft-computing-lab-1-320.jpg)

![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]')](https://image.slidesharecdn.com/softlab2-211110180535/85/Soft-computing-lab-3-320.jpg)
![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]);](https://image.slidesharecdn.com/softlab2-211110180535/85/Soft-computing-lab-4-320.jpg)
![Gaussian membership function :-
x=0:0.1:20;
y=gaussmf(x,[2 10]);
plot(x,y)](https://image.slidesharecdn.com/softlab2-211110180535/85/Soft-computing-lab-5-320.jpg)
![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])](https://image.slidesharecdn.com/softlab2-211110180535/85/Soft-computing-lab-6-320.jpg)
![Gaussian bell membership function :-
x=0:0.1:20;
y=gbellmf(x,[4 6 12]);
plot(x,y)](https://image.slidesharecdn.com/softlab2-211110180535/85/Soft-computing-lab-7-320.jpg)
