Sin, Cos, Exp Insingle Figure
Sin, Cos, Exp Insingle Figure
1.5
amplitude-->
0.5
-0.5
-1 0
0.5
1.5 w-->
2.5
3.5
AIM: 1. TO DRAW SINE, COSINE AND EXPONENTIAL CURVE IN 1 FIGURE USING DIFFERENT COLORS USING MATLAB 2. TO DRAW UNIT STEP, IMPULSE, RAMP SIGNALS IN DIFFERENT FIGURES
THEORY
Sine Function: A function f(x)=sin(x) is a periodic function with a period of 2, it will form a periodic wave after 2. The f(x) will lie between -1 to +1.
Cosine Function: A function f(x)=cos(x) is a periodic function with a period of 2, it will form a periodic wave after 2.
0<f(x)1; 1f(x)<;
Unit impulse Function: Unit impulse is a signal that is 0 everywhere except at n=0 where it is 1. In discrete time domain the unit impulse signal is defined as: (n) =1; = 0; n=0 elsewhere
Unit Step Function: The integral of the impulse function is a unit step signal. In discrete time unit step signal is defined as:
U(n) =1; = 0;
n>=0 n<0
Unit ramp function: The integral of the step function is a unit ramp signal. It is defined as: R(n)=kt; n>=0 =0; n<0
clc; clear all; close all; w=0:0.01:pi; a=sin(w); b=cos(w); c=exp(w); plot(w ,a, 'r' ,w ,b, 'g', w,(c/10),'b'); title('sine cosine and exponential curve'); xlabel('w-->'); ylabel('amplitude-->');
clc clear all close all w=-50:1:50; y=ones(1,51); x=zeros(1,50); z=[x ,y]; figure; stem(w ,z); ylabel('amplitude-->'); xlabel('n-->'); title('UNIT STEP SIGNAL');
0.9
0.8
0.7
0.6
amplitude-->
0.5
0.4
0.3
0.2
0.1
0 -50
-40
-30
-20
-10
0 n-->
10
20
30
40
50
clc clear all close all w=-50:1:50; x=[zeros(1,50),ones(1,1),zeros(1,50)]; figure; stem(w ,x); ylabel('amplitude-->'); xlabel('n-->'); title('UNIT IMPULSE SIGNAL');
0.9
0.8
0.7
0.6
amplitude-->
0.5
0.4
0.3
0.2
0.1
0 -50
-40
-30
-20
-10
0 n-->
10
20
30
40
50
clc clear all close all w=-50:1:50; figure; stem(w ,w); ylabel('amplitude-->'); xlabel('n-->');
title('UNIT RAMP SIGNAL');
40
30
20
10
amplitude-->
-10
-20
-30
-40
-50 -50
-40
-30
-20
-10
0 n-->
10
20
30
40
50