Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Experiment No: 01

Name of the experiment: Understanding the Haar-Wavelet Transform using MATLAB


MATLAB code:
x=sin(0:1/100:999/100);
xn=x+randn(1,1000);
[c,l]=wavedec(xn,3,'db2');
approximation=appcoef(c,l,'db2');
[d1,d2,d3]=detcoef(c,l,[1,2,3]);
subplot(5,1,1);
plot(xn);
title('original signal');
subplot(5,1,2);
plot(approximation);
title('approximation');
subplot(5,1,3);
plot(d3);
title('detail coefficient at level 3');
subplot(5,1,4);
plot(d2);
title('detail coefficient at level 2');
subplot(5,1,5);
plot(d1);
title('detail coefficient at level 1');
Experiment No: 02
Name of the experiment: Understanding the Walsh-Hadamard Transform (WHT) using MATLAB
Theory:
Walsh-Hadamard Transform (WHT) of 1D (one dimensional) signal
Y=(1/N)*Hn*x[n]
Where,
N=number of row of given signal matrix
Hn=Hadamard or walsh matrix
Inverse Walsh-Hadamard Transform (IWHT) of 1D signal
X=Hn*Y
Walsh-Hadamard Transform (WHT) of 2D (two dimensional) signal
Y=(1/N2)*Hn*x[n]* Hn
Inverse Walsh-Hadamard Transform (IWHT) of 2D signal
X=Hn*Y* Hn

MATLAB code:
Walsh-Hadamard Transform (WHT) of 1D (one dimensional) signal
I. Using fundamental equation
x=[1;5;-3;2];
H=hadamard(4);
Y=(1/4)*H*x;
ix=H*Y;

II. Using inbuilt function


x=[1;5;-3;2];
Y=fwht(x,4,'hadamard');

ix=ifwht(Y,4,'hadamard');
Walsh-Hadamard Transform (WHT) of 2D (two dimensional) signal
I. Using fundamental equation
I=[50, 28, 10, 25; 40, 12, 23, 40; 45, 62, 15, 23; 28, 25, 33, 34];
H=hadamard(4);
Y=(1/16)*H*I*H;
iI=H*Y*H;

Experiment No: 03
Name of the experiment: Understanding the Fuzzy Logic Controller using MATLAB Simulik.
Theory:
MATLAB Simulation:

1. To open the fuzzy logic tool, Type ‘fuzzy’ on your command window.
2. Following window will appear

3. Select input1, go through as Edit >>> Add variable >>> input , then new input will be added as
follows
4. Click on input1, change Name input1 to Dirt, Repeat to rename input2 to Grease, output1 to wash
time

5. Double click on Dirt, select mf1 line, change Name mf1 to SD, set the Range [0 100], set Params
[0 0 50] , hit the Enter key
6. Repeat the previous step to set mf2 to MD, Range [0 100], set Params [0 50 100] and mf3 to LD,
Range [0 100], set Params [50 100 100]
7. Click on Grease, select mf1 line, change Name mf1 to
NG, set the Range [0 100], set Params [0 0 50] , hit
the Enter key
8. Repeat the previous step to set mf2 to MG, Range [0
100], set Params [0 50 100] and mf3 to LG, Range [0
100], set Params [50 100 100]

9. Click on Wash time, Delete all mf1, mf2 and mf3. Go


to Edit >>>Add MFs >>> Number of MFs >>> select
5.
10. Select mf1 line, change Name mf1 to VS, set the Range [0 60], set Params [0 0 10] , hit the Enter
key.
11. Repeat the previous step to set mf2 to S, Range [0 60], set Params [0 10 25] ; mf3 to M, Range [0
60], set Params [10 25 40]; mf4 to L, Range [0 60], set Params [25 40 60]; mf5 to VL, Range [0
60], set Params [40 60 60]; Click the close button.

12. Double click on Untitled (mamdani), select two input SD, NG and corresponding output VS, click on
Add rule. Repeat it for corresponding rest of eight inputs output combination. Make sure and is
checked Click on close button.
13. Click on View>>> Rules. Set the Desired input values to [60 70].

14. Save your file by pressing Cntrl+S on specific folder.

15. Change the current folder directory from the left of your command window.

16. Type test=readfis('your file name') on command window

17. Type evalfis([60,70],test) on command window

18. Type surfview(test) on command window

Exercise:
1. I=[50, X, 10, 25; 40, 12, 23, 40; 45, 62, 15, 23; X+1, 25, 33, 34]; where X is last two digit of your
ID. Apply Walsh-Hadamard Transform (WHT) of I by hand calculation and by MATLAB code.

2. Generate a noisy signal and perform Haar-Wavelet Transform using MATLAB.

3. Design a fuzzy controller for a steam turbine assuming the input of the controller as temperature and
pressure. The output will be the throttle setting of a steam turbine. Use three descriptors for input and
five descriptors for output variables. Derive the set of rules for controller action and get the de-fuzzified
values.
Hints: temperature={cool, nominal, warm}, pressure={low, ok, strong}, throttle setting of
turbine={large negative, small negative, Zero, small positive, large positive}
Range: temperature: 0 ≤ x ≤ 40, pressure: 0 ≤ y ≤ 100, output: -100 ≤ x ≤ 100

4. Design a controller to control the speed of a dc motor by changing the input voltage. Assume input is
speed of the motor in RPM and output is input voltage for the controller. Use three descriptors for
input and output variables. Derive the set of rules for controller action and get the de-fuzzified values.
Hints: As here only one input variable, no input combinations is required, just set the rule between
input and output.

Instruction: Generate a pdf file containing all hand calculation, MATLAB code and screen shot of the
output. For the question 3 and 4, send corresponding .fis file also.

You might also like