Cosine wave:
f =0.2;
t =0:0.1:10;
x = cos (2* %pi * t * f ) ;
plot (t ,x )
title ( ' cosine wave ' ) ;
xlabel ( ' t ' ) ;
ylabel ( ' x ' ) ;
Cosine wave in discrete form:
f =0.2;
t =0:0.1:10;
x = cos (2* %pi * t * f ) ;
plot2d3 (t ,x )
title ( ' cosine wave ' ) ;
xlabel ( ' t ' ) ;
ylabel ( ' x ' ) ;
Sinc function:
t = -10:0.1:10
x = sinc ( t ) ;
plot (t ,x )
title ( ' sinc wave ' ) ;
xlabel ( ' t ' ) ;
ylabel ( 'x ' ) ;
Sinc function in discrete form:
t = -10:0.2:10
x = sinc ( t ) ;
plot2d3 (t ,x )
title ( ' sinc wave ' ) ;
xlabel ( ' t ' ) ;
ylabel ( 'x ' ) ;
Square wave:
clf;
t = linspace(0,10,500);
vm = 5*squarewave(t);
plot(t,vm)
Square wave in discrete form:
clf;
t = linspace(0,10,50);
vm = 5*squarewave(t);
plot2d3(t,vm)
Triangular wave:
a =8;
t =0:( %pi /4) :(4* %pi ) ;
y = a *sin ( 2*t ) ;
plot (t ,y )
title ( ' triangular wave ' ) ;
xlabel ( ' t ' ) ;
ylabel ( ' y ' ) ;
Signum function:
t = -5:0.1:5
x = sign ( t ) ;
plot2d3 (t ,x )
title ( ' signum function ' ) ;
Exponential function:
t = -2:0.1:2;
x = exp (t ) ;
plot (t ,x )
title ( ' exponential wave ' ) ;
xlabel ( ' t ' ) ;
ylabel ( ' x ' ) ;
Exponential function in discrete form:
t = -2:0.1:2;
x = exp (t ) ;
plot2d3 (t ,x )
title ( ' exponential wave ' ) ;
xlabel ( ' t ' ) ;
ylabel ( ' x ' ) ;
Addition of signals in continuous form:
clc ;
clf ;
clear all;
t =0:0.1:30
x1 =sin (2* %pi * t /9) ;
x2 =sin (2* %pi * t /2) ;
x3 = x1 + x2 ;
subplot (1 ,3 ,1) ;
plot (t , x1 ) ;
title ( ' sinewave1 ' );
xlabel ( ' t ' ) ;
ylabel ( ' x1 ( t ) ' ) ;
subplot (1 ,3 ,2) ;
plot (t , x2 ) ;
title ( ' sinewave2 ' ) ;
xlabel ( ' t ' ) ;
ylabel ( ' x2 ( t ) ' ) ;
subplot (1 ,3 ,3) ;
plot (t , x3 ) ;
title ( ' addition of 2 signals ' ) ;
xlabel ( ' t ' ) ;
ylabel ( ' x3 ( t ) ' ) ;
Addition of signals in discrete form:
N =5;
n =0:0.1: N -1;
x1 =sin (1* %pi * n) ;
x2 =sin (2* %pi * n) ;
x3 = x1 + x2 ;
figure (1) ;
subplot (1 ,3 ,1) ;
plot2d3 (n , x1 ) ;
title ( " s i n e wave1 " );
xlabel ( 'n ' ) ;
ylabel ( ' x1 ( n ) ' ) ;
subplot (1 ,3 ,2)
plot2d3 (n , x2 ) ;
title ( " si n e w a v e 2 " );
xlabel ( ' n ' ) ;
ylabel ( ' x2 ( n ) ' ) ;
subplot (1 ,3 ,3) ;
plot2d3 (n , x3 ) ;
title ( " a d d i t i o n of 2 s i g n a l s " );
xlabel ( ' n ' ) ;
ylabel ( ' x3 ( n ) ' ) ;
Addition of signals:
clc ;
clear all;
t =0:.01: %pi ;
// g e n e r a t i o n of s i n e s i g n a l s
y1 =sin( t ) ;
y2 =sin (3* t ) /3;
y3 =sin (5* t ) /5;
y4 =sin (7* t ) /7;
y5 =sin (9* t ) /9;
y = sin (t ) + sin (3* t ) /3 + sin (5* t ) /5 + sin (7* t) /7 + sin (9* t ) /9;
plot (t ,y ,t , y1 ,t , y2 ,t , y3 ,t , y4 ,t , y5 ) ;
legend ( 'y','y1','y2','y3','y4','y5' ) ;
title ( ' generation of sum of sinusoidal signal ' ) ;
xgrid (1) ;
ylabel ( '−−−> Ampli tude ' ) ;
xlabel ( '−−−> t ' ) ;
Step function:
t=0:4;
y=ones(1,5);
subplot(2,1,1);
plot2d3 (t,y);
xlabel('time');
ylabel('amplitude');
title('Unit Step Discrete Signal');
subplot(2,1,2);
plot(t,y);
xlabel('time');
ylabel('amplitude');
title('Unit Step Continuous Signal');
Impulse function:
// impulse
l = 5;
n = -l:l;
x = [zeros(1,l), ones(1,1), zeros(1,l)];
plot2d3(n,x);
Ramp function:
n = 0:10;
x = n;
subplot(211)
plot2d3(n,x);
subplot(212)
plot(n,x)