







































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This manual provides Scilab codes for generating and processing various types of signals, including continuous, discrete, sinusoidal, complex exponential, exponentially growing & decaying signals, and their addition and convolution. It also includes codes for sampling and aliasing processes, DFT and FFT of a signal.
Typology: Study Guides, Projects, Research
1 / 47
This page cannot be seen from the preview
Don't miss anything!








































(^1) Funded by a grant from the National Mission on Education through ICT,
http://spoken-tutorial.org/NMEICT-Intro. This Scilab Manual and Scilab codes written in it can be downloaded from the โMigrated Labsโ section at the website http://scilab.in
Scilab code Solution 1.1 sinewave
1 clc ; 2 clf ; 3 clear all ; 4 // C a p t i o n : g e n e r a t i o n o f s i n e wave 5 f =0.2; 6 t =0:0.1:10; 7 x = sin (2* %pi * t * f ) ; 8 plot (t ,x ) ; 9 title ( โ s i n e wave โ ) ; 10 xlabel ( โ t โ ) ; 11 ylabel ( โ x โ ) ;
Scilab code Solution 1.2 cosine wave
Figure 1.1: sinewave
Figure 1.2: cosine wave
Figure 1.4: signum function
1 clc ; 2 clf ; 3 clear all ; 4 // C a p t i o n : g e n e r a t i o n o f t r i a n g u l a r wave 5 a =8; 6 t =0:( %pi /4) :(4* %pi ) ; 7 y = a * sin (2* t ) ; 8 a = gca () ; 9 a. x_location = โ m i d d l e โ 10 plot (t ,y ) ; 11 title ( โ t r i a n g u l a r wave โ ) ; 12 xlabel ( โ t โ ) ; 13 ylabel ( โ y โ ) ;
Figure 1.5: sinc function
Scilab code Solution 1.4 signum function
1 clc ; 2 clf ; 3 clear all ; 4 // C a p t i o n : signum f u n c t i o n 5 t = -5:0.1: 6 a = gca () ; 7 a. x_location = โ m i d d l e โ 8 x = sign ( t ) ; 9 b = gca () ; 10 b. y_location = โ m i d d l e โ 11 plot (t ,x ) ; 12 title ( โ signum f u n c t i o n โ ) ;
Scilab code Solution 1.6 Exponential wave
1 clc ; 2 clf ; 3 clear all ; 4 // C a p t i o n : g e n e r a t i o n o f e x p o n e n t i a l wave 5 t = -2:0.1:2; 6 x = exp (t ) ; 7 plot (t ,x ) ; 8 title ( โ e x p o n e n t i a l wave โ ) ; 9 xlabel ( โ t โ ) ; 10 ylabel ( โ x โ ) ;
Scilab code Solution 2.1 unit impulse signal
1 clc ; 2 clf ; 3 clear all ; 4 // u n i t i m p u l s e 5 L =5; 6 n = - L : L; 7 x =[ zeros (1 , L ) , ones (1 ,1) , zeros (1 , L ) ]; 8 a = gca () ; 9 a. y_location = โ m i d d l e โ 10 plot2d3 (n ,x ) ; 11 title ( โ u n i t i m p u l s e โ ) ;
Scilab code Solution 2.2 unitstepsignal
Figure 2.3: discreteexponentialwave
1 clc ; 2 clf ; 3 clear all ; 4 L =5; 5 n = - L : L; 6 x =[ zeros (1 , L ) , ones (1 , L +1) ]; 7 a = gca () ; 8 a. y_location = โ m i d d l e โ ; 9 plot2d3 (n ,x ) ; 10 title ( โ u n i t s t e p โ ) ; 11 xlabel ( โ n โ ) ; 12 ylabel ( โ x โ ) ;
Scilab code Solution 2.3 discreteexponentialwave
Figure 2.4: unit ramp
1 // u n i t e x p o n e n t i a l 2 clc ; 3 clf ; 4 clear all ; 5 a =1; 6 x = exp (a * t ) ; 7 plot2d3 ( x ); 8 title ( โ e x p o n e n t i a l s i g n a l โ ) ; 9 xlabel ( โ t โ ) ; 10 ylabel ( โ x โ ) ;
Scilab code Solution 2.4 unit ramp
1 // u n i t ramp
Scilab code Solution 3.1 Generation of sinusoidal signals
1 clc ; 2 clear all ; 3 tic ; 4 t =0:.01: %pi ; 5 // g e n e r a t i o n o f s i n e s i g n a l s 6 y1 = sin ( t ) ; 7 y2 = sin (3* t ) /3; 8 y3 = sin (5* t ) /5; 9 y4 = sin (7* t ) /7; 10 y5 = sin (9* t ) /9; 11 y = sin (t ) + sin (3* t ) /3 + sin (5* t ) /5 + sin (7* t ) /7 + sin (9* t ) /9; 12 plot (t ,y ,t , y1 ,t , y2 ,t , y3 ,t , y4 ,t , y5 ) ; 13 legend ( โ y โ , โ y1 โ , โ y2 โ , โ y3 โ , โ y4 โ , โ y5 โ ) ; 14 title ( โ g e n e r a t i o n o f sum o f s i n u s o i d a l s i g n a l s โ ) ; 15 xgrid (1) ; 16 ylabel ( โโโโ> Amplitu de โ ) ;
Figure 3.1: Generation of sinusoidal signals
17 xlabel ( โโโโ> t โ ) ; 18 toc ;