Anda di halaman 1dari 9

Hitec University

Department Of Electrical Engineering


Heavy Industries Taxila Education City

Project Report

Signal And System


Matlab

Group Members:

Ishfaq Ahmad (08-Hitec-EE-63)

Masab Anis (08-Hitec-EE-76)

Ishfaq Hussain (08-Hitec-EE-64)

Submitted To:

Engr. Hira Bashir


Acknowledgment

In This Project we develop an environment, which is very useful for understanding the
behavior of signals in time and frequency domain. We have three basic signals ,which
are Sin,Cos,Tan..In this Project we studied these three signals in time and frequency
domain. Also we included an Exponentional Function in frequency domain by calculating
it forior and than plotting it.It tells us that how signals behave ,when we change their
domains. The main purpose was to study the Graphical user interphase and its
understanding.So we learn it by building this mini project on Matlab.
Contents

1-Graphical User Interphase

1.1 Introduction to GUI

1.2 How to access and use the GUI

2-Coding

2.2 Code for Sin function

2.2 Code for Cos function

2.3 Code for Tan function

2.4 Code for Exponentional function.

3-Output

3.1 Combine output for all functions

4-Conclusion
Graphical User Interphase

Introduction to GUI:

The graphical user interface (GUI) is designed to be simple


and user friendly. A simple example will get you started.You bring up a GUI
Network/Data Manager window. This window has its own work area, separate from
the more familiar command-line workspace. Thus, when using the GUI, you might
export the GUI results to the (command-line) workspace. Similarly, you might want to
import results from the workspace to the GUI.Once the Network/Data Manager
window is up and running, you can create a network, view it, train it, simulate it, and
export the final results to the workspace. Similarly, you can import data from the
workspace for use in the GUI.The following example deals with a perceptron network.
It goes through all the steps of creating a network and shows what you might expect to
see as you go along.

How to access and use the GUI:

To access the access the GUI we have to follow the following steps.

1- The first step is to write the Guide in Command Window and the following
window will be open.

2-Than we will select Blank (Default) and the following window will be open.
3-From the following , we will select our desird components from list and drag it into
the window.

There are 13 buttons in this window.Every button has its own specific operation and
requird programming to perform that operation.

When we select a button than we will set its properties by using properties
inspector.Two types of files are created when we select and drag the button into the
window.one is fig file and other is m file.M file has the coding of the program.
The properties inspector has the following properties.
Coding

Code for Sin function:

% Get user input from GUI


f1 = str2double(get(handles.f1_input,'String'));
f2 = str2double(get(handles.f2_input,'String'));
t = eval(get(handles.t_input,'String'));

% Calculate data
x = Sin(2*pi*f1*t) + Sin(2*pi*f2*t);
y = fft(x,512);
m = y.*conj(y)/512;
f = 1000*(0:256)/512;

% Create frequency plot


axes(handles.frequency_axes)
plot(f,m(1:257))
set(handles.frequency_axes,'XMinorTick','on')
grid on

% Create time plot


axes(handles.time_axes)
plot(t,x)
set(handles.time_axes,'XMinorTick','on')
grid on

Code for Cos function:

% Get user input from GUI


f1 = str2double(get(handles.f1_input,'String'));
f2 = str2double(get(handles.f2_input,'String'));
t = eval(get(handles.t_input,'String'));

% Calculate data
x = Cos (2*pi*f1*t) + Cos(2*pi*f2*t);
y = fft(x,512);
m = y.*conj(y)/512;
f = 1000*(0:256)/512;

% Create frequency plot


axes(handles.frequency_axes)
plot(f,m(1:257))
set(handles.frequency_axes,'XMinorTick','on')
grid on
% Create time plot
axes(handles.time_axes)
plot(t,x)
set(handles.time_axes,'XMinorTick','on')
grid on

Code for Tan function:

% Get user input from GUI


f1 = str2double(get(handles.f1_input,'String'));
f2 = str2double(get(handles.f2_input,'String'));
t = eval(get(handles.t_input,'String'));

% Calculate data
x = Tan(2*pi*f1*t) + Tan(2*pi*f2*t);
y = fft(x,512);
m = y.*conj(y)/512;
f = 1000*(0:256)/512;

% Create frequency plot


axes(handles.frequency_axes)
plot(f,m(1:257))
set(handles.frequency_axes,'XMinorTick','on')
grid on

% Create time plot


axes(handles.time_axes)
plot(t,x)
set(handles.time_axes,'XMinorTick','on')
grid on

Code For Exponentional Function:

syms t;
f=fourier(exp(-abs(t)));
ezplot(f);
axes(handles.axes1)
Output

Combine output for all functions:

Similarly for exponentional function:


Conclusion:

We conclude that our code is very useful for understanding the behaviour of some basic
signals(exponantional,sine,cos and tan) in two different domain(time and frequency).It
provides the user facility of observing the signal by zoom in and out.our code also
provide the user the graphical output for better understanding.. .

Anda mungkin juga menyukai