MATLAB For Basic Electrical Engineering
MATLAB For Basic Electrical Engineering
SOFTWARE REQURIED:-
1.MATLAB R2010a.
2.Windows XP SP2.
THEORY:-
One of the more useful functions in the study of linear systems is the "unit impulse function."
An ideal impulse function is a function that is zero everywhere but at the origin, where it is
infinitely high. However, the area of the impulse is finite. This is, at first hard to visualize but
The unit step function and the impulse function are considered to be fundamental functions in
engineering, and it is strongly recommended that the reader becomes very familiar with both of
these functions.
The unit step function, also known as the Heaviside function, is defined as such:
Sometimes, u(0) is given other values, usually either 0 or 1. For many applications, it is
irrelevant what the value at zero is. u(0) is generally written as undefined.
Derivative
The unit step function is level in all places except for a discontinuity at t = 0. For this reason, the
derivative of the unit step function is 0 at all points t, except where t = 0. Where t = 0, the
derivative of the unit step function is infinite.
The derivative of a unit step function is called an impulse function. The impulse function will
be described in more detail next.
Integral
The integral of a unit step function is computed as such:
Sinc Function
There is a particular form that appears so frequently in communications engineering, that we
give it its own name. This function is called the "Sinc fu
The Sinc function is defined in the following manner:
And
Sinc(0)=1
The value of sinc(x) is defined as 1 at x = 0, since
Then, since
Then, since cos(0) = 1, we can apply the approaches one as x goes to zero. Thus, defining s
continuous.
Also, the Sinc function approaches zero as x goes towards infinity, with the envelope of sinc(x)
tapering off as 1/x.
Rect Function
centered at t = 0. The Rect function pulse also has a height of 1. The Sinc function and the
where the pulse is centered at X and has width Y. We can define the impulse function above in
terms of the rectangle function by centering the pulse at zero (X = 0), setting it's height to 1/A
and setting the pulse width to A, which approaches zero:
We can also construct a Rect function out of a pair of unit step functions
Here, both unit step functions are set a distance of Y/2 away from the center point of (t - X).
SAW TOOTH:-
named a sawtooth based on its resemblance to the teeth on the blade of a saw. The
convention is that a sawtooth wave ramps upward and then sharply drops. However, there
are also sawtooth waves in which the wave ramps downward and then sharply rises. The
latter type of sawtooth wave is called a 'reverse sawtooth wave' or 'inverse sawtooth
wave'. As audio signals, the two orientations of sawtooth wave sound identical. The
bandlimited triangle wave pictured in the time domain (top) and frequency domain
(bottom). The fundamental is at 220 Hz (A2).Like a square wave, the triangle wave
contains only odd harmonics. However, the higher harmonics roll off much faster than in
a square wave (proportional to the inverse square of the harmonic number as opposed to
just the inverse).It is possible to approximate a triangle wave with additive synthesis by
adding odd harmonics of the fundamental, multiplying every (4n1)th harmonic by 1
(or changing its phase by ), and rolling off the harmonics by the inverse square of their
relative frequency to the fundamental.This infinite Fourier series converges to the triangle
wave:
where f is the signal frequency, fs is the sampling frequency, is the phase and A is the
amplitude of the signal.
PROCEDURE:-
1. Open MATLAB
stem(t,x,'r');
xlabel('time');
ylabel('amplitude');
title('unit step discreat function');
%unit ramp function%
%unit ramp function%
clc;
clear all;
close all;
t=0:20;
x=t;
subplot(2,1,1);
plot(t,x,'g');
xlabel('time');
ylabel('amplitude');
title('unit ramp function');
subplot(2,1,2);
stem(t,x,'r');
xlabel('time');
ylabel('amplitude');
title('unit ramp discreat function');
%sinusoidal function%
clc;
clear all;
close all;
t=0:0.01:2;
x=sin(2*pi*t);
subplot(2,1,1);
plot(t,x,'g');
xlabel('time');
ylabel('amplitude');
title('sinusoidal signal');
subplot(2,1,2);
stem(t,x,'r');
xlabel('time');
ylabel('amplitude');
title('sinusoidal sequence');
%square function%
clc;
clear all;
close all;
t=0:0.01:2;
x=square(2*pi*t);
subplot(2,1,1);
plot(t,x,'g');
xlabel('time');
ylabel('amplitude');
title('square signal');
subplot(2,1,2);
stem(t,x,'r');
xlabel('time');
ylabel('amplitude');
title('square sequence');
%sawtooth function%
clc;
clear all;
close all;
t=0:0.01:2;
x=sawtooth(2*pi*5*t);
subplot(2,1,1);
plot(t,x,'g');
xlabel('time');
ylabel('amplitude');
title('sawtooth signal');
subplot(2,1,2);
stem(t,x,'r');
xlabel('time');
ylabel('amplitude');
title('sawtooth sequence');
%trianguler function%
clc;
clear all;
close all;
t=0:0.01:2;
x=sawtooth(2*pi*5*t,0.5);
subplot(2,1,1);
plot(t,x,'g');
xlabel('time');
ylabel('amplitude');
title('trianguler signal');
subplot(2,1,2);
stem(t,x,'r');
xlabel('time');
ylabel('amplitude');
title('trianguler sequence');
%sinc function%
clc;
clear all;
close all;
t=linspace(-5,5);
x=sinc(t);
subplot(2,1,1);
plot(t,x,'g');
xlabel('time');
ylabel('amplitude');
title('sinc signal');
subplot(2,1,2);
stem(t,x,'r');
xlabel('time');
ylabel('amplitude');
title('sinc sequence');
unit impulse function