Professional Documents
Culture Documents
MATLAB GUI
(CALCULATOR, PLOTS, RESPONSES, CONVOLUTION)
Submitted by
RISHYAB KOUL (R-10)
SHRIJAY KALAMBE (Q-27)
SANDEEP SURYAWANSHI (R-16)
CERTIFICATE
This is to certify that the mini project titled MATLAB GUI has been completed in the
academic year 2012-13 by RISHYAB KOUL (R-10), SHRIJAY KALAMBE (Q-27) and
SANDEEP SURYAWANSHI (R-16) in partial fulfillment of the Bachelors Degree in the
second Year Instrumentation Engineering as prescribed by the University of Pune.
(Guide)
Place: Pune
Date:
ACKNOWLEDGEMENT
We would like to thank our project guide Prof. Mrs. S.S.Patankar for her valuable
guidance, suggestions and timely help in the completion of project report on
MATLAB GUI. We would also like to extend our sincere gratitude to Prof. Dr. J.V.
KULKARNI Head of Department and all the staff members of the Instrumentation and
Control Engineering Department for their timely support, encouragement and
guidance. Last but not the least we express profuse regards and deep wishes to friends
who gave helping hands with their direct and indirect co-operation.
Table of Contents
Chapter
Sr. No.
Topic
Page
No.
Introduction
1.1
Motivation
1.2
Scope
1.3
Problem statement
Calculator
2.1
Function used
2.2
Flow chart
2.3
Pseudo code
10
2.4
Testing
10
Plot
11
3.1
Function used
11
3.2
Flow chart
12
3.3
Pseudo code
13
3.4
Testing
13
Responses
14
4.1
Function used
14
4.2
Flow chart
15
4.3
Pseudo code
16
4.4
Testing
16
Convolution
17
5
4
5.1
Function used
18
5.2
Flow chart
19
5.3
Pseudo code
20
5.4
Testing
20
Step
21
6.1
Function used
21
6.2
Flow chart
22
6.3
Pseudo code
23
6.4
Testing
23
bode
24
7.1
Function used
24
7.2
Flow chart
25
7.3
Pseudo code
26
7.4
Testing
26
Conclusion/Future scope
27
Bibliography
28
List of Figures
Sr. No.
Topic
Page no.
11
14
17
20
23
Chapter 1.
Introduction
1.1
Motivation:
We have studied the Signals and system and Control System then we came across many terms
like bode plot, impulse response, step response, convolution of two signals. We have
implemented this all in the very wonderful matrix laboratory tool MATLAB, and then we
thought of making it very user friendly so that without knowing the programming for the
particular function one can use it.
For that we used the Matlab GUI tool to make it user friendly in this way we come up with this
project.
1.2
Scope:
By using this matlab GUI tool the mathematical concept like impulse response, step response,
bode plot, convolution can be made very user friendly without knowing these above concepts
how to implement in matlab one can use this tool. No need to do programming again and again it
will save lots of time of user to get output.
1.3
Problem statement:
Chapter 2.
CHECK IF
THE
NUMBER
IS PRESNT
IN TEXT
BOX
STRING =STRING
THROGH THE INPUT
+STRING FROM TEXT BOX
RESULT
STOP
9
2.3 Algorithm:
1. For this we have first made GUI ,added this push button to which will serve as an input
for taking the number through user and arithmetical input such as ( + ,- , *, /, )
2. We have added static text box for displaying input which is given by user and for
showing the result.
3. Here we have used the logic as taking input from user as string it will take as string
from the user through button and it will add this string to string which if already present
in the static text box .
4. PSUDO CODE FOR THIS IS AS FOLLOW
n=get(handles.text1,'String');
m=get(handles.pushbutton17,'String');
set(handles.text1,'string',strcat(n,m))
% Here we adding two string through function strcat
When we press the equal to (=) button the this string which is present
in static text bar will be converted into the number by using
comment% str2num
n=str2num(get(handles.text1,'String'));
set(handles.text1,'string',n)
For function like all clear [AC] we have made hole string zero .
set(handles.text1,'string','0')
2.4 Testing:
1 This follows bodmos rule if you gave function
2*3 +4 it will give 10
2. This calculator will give the output for division by zero to any no. as inf means infinity
Eg 4/0 =inf
3 Here we have faced problem while developing scientific calculator.
4 we are trying to develop on the scientific calculator
10
Chapter 3:
Plots:
11
3.1 Flowchart
START
INPUT
RANGE OF T
STOP
12
3.2 Algotrithm:
1. For this we have made the GUI , which consist of button and axis ,edit text
2. Buttons are given
function to
plot the
curves of sin ,cos
t=str2num(get(handles.edit1,'string')
r=get(handles.edit2,'string')
p=plot(t,r);
set(handles.axes1,'string',p)
3. here t is for taking the range in the form string converting into number
4. r is taking trigonometric function by putting value of t in it
5. Plot function is plotting the graph of t and r
6. Set is plotting this graph in axes
,tan
3.3 Testing
1. Here we are able to plot the basic plots sine, cos, tan with the given range of t.
E.g. sin(t) here ts range 0.1:0.1:5 then we are plotting the plot of sin(t), t.
2. We have faced the problem that we cant give the input function from the user.
3. And here we are planning to add the exponential function and logarithmic function in the near
future.
4. And we are also studying how to add the function from the user.
13
Chapter 4.
Convolution
14
tt=str2num
(get(handl
es.edit1,'
string'))
h=inline('(2*((t=
=6)-(.8).^(t+2))).*(t>
=1)','t')
tvec=str2num(get(han
dles.edit2,'string')
)
T1
T2
Signal 1
Signal 2
Fig
1
x=inline('((exp(1)/10).^(
t-2)).*(t>=-5)','t')
Fig
2
Convolution
t=tvec
ti=ti+1;
xh=h(t-tau).*x(tau);
y(ti)=sum(xh.*dtau);
For loop
Condn(?)
RESULT
END
STOP
15
4.3 Algorithm
1. For this we have first made GUI figure shown above ,here T1 & T2 button
will give time period for the signals to generate the graph of the signals.
2. Then from the signals two figures will generate to which we have to
convolute.
3. These two graph or (signals) undergo the convolution on pressing
convolution.
4. After that we will get the output of the two signals as a convolution or as a
result.
5. For that we have shown below the flow diagram and the logic for the
following.
6. Stop.
Testing:
1. Here we are taking two functions range from user and we are plotting the convolution
sum graphically.
2. And here also we are not able to take the input function from the user.
3. We are studying how to take the input function from the user.
16
Chapter 5
Impulse
impulse
6 tf
17
5.2Flow chart:
START
t=str2num(get(handles.edit1,'string'))
DEN
NUM
M
Impulse(G)
Plot is obtained
END
18
5.3Algoritham
1. For this we have first made GUI, added this push button (NUM, DEN) to which will
serve as an input for taking the number through user.
2. We have added static text box for displaying input which is given by user and for
showing the result.
3. Here we have used the logic as taking input from user as string it will take as string
from the user through button and it will add this string to string which if already present
in the static text box .
4. PSUDO CODE FOR THIS IS AS FOLLOW
num=1
t=str2num(get(handles.edit1,'string'))
g=tf(num,t)
impulse(g)
title('impulse response')
xlabel('time')
ylabel('amplitude')
set(handles.axes1,'string',p)
5.4 Testing :
1. We are taking the range of input function from the user and plotting the impulse
response of the system.
2. And we are not able to take the input function from the user.
3. We are studying how to take the function from the user.
19
Chapter 6
Step
impulse
6 tf
20
Flow chart:
START
t=str2num(get(handles.edit1,'string'))
DEN
NUM
M
G=tf (NUM,DEN
)
step(g)
Step(G)
Plot is obtained
END
21
6.2 Algorithm:
1. For this we have first made GUI, added this push button (NUM, DEN) to which will
serve as an input for taking the number through user.
2. We have added static text box for displaying input which is given by user and for
showing the result.
3. Here we have used the logic as taking input from user as string it will take as string
from the user through button and it will add this string to string which if already present
in the static text box .
4. PSUDO CODE FOR THIS IS AS FOLLOW
num=1
t=str2num(get(handles.edit1,'string'))
g=tf(num,t)
step(g)
title('impulse response')
xlabel('time')
ylabel('amplitude')
set(handles.axes1,'string',p)
6.3Testing :
1We are taking the range of input function from the user and plotting the step response of
the system.
2And we are not able to take the input function from the user.
3We are studying how to take the function from the user.
22
Chapter 7
Bode plot
23
t=str2num(get
(handles.edit1,
'string'))
DEN
NUM
M
Step(G)
Plot is obtained
END
24
step(g)
t=str2num(get
(handles.edit1,'
string'))
7.4 Algorithm:
1. For this we have first made GUI, added this push button (NUM, DEN) to which will
serve as an input for taking the number through user.
2. We have added static text box for displaying input which is given by user and for
showing the result.
3. Here we have used the logic as taking input from user as string it will take as string
from the user through button and it will add this string to string which if already present
in the static text box .
4. PSUDO CODE FOR THIS IS AS FOLLOW
num=str2num(get(handles.edit1,'string'))
den=str2num(get(handles.edit2,'string'))
g=tf(num,den)
bode(g)
title('bode graph')
grid on
xlabel('frequency')
ylabel('amplitude')
margin(g)
set(handles.axes1,'string',p)
7.5 Testing:
1. We are taking the numerator and denominator of the input system from the user and
plotting the bode and the gain and phase margin.
25
Chapter 8
26
BIBLIOGRAPHY
1. www.mathworks.com
2. Build GUI
3. Control system by OGATA
4. Signal and system by Ramesh Babu
27