0% found this document useful (0 votes)
43 views

Laboratory Experiment No. - : Generation of Continuous Signal (Analysis of Controlled System 2)

This MATLAB program generates six different continuous time signals: a unit step function, ramp function, sinusoidal function, triangular waveform, sawtooth waveform, and sinc function. The program defines a time vector t, then uses if/else statements and built-in MATLAB functions like sin, sawtooth, and sinc to calculate each signal over t and plot the results in a 2x3 subplot. The objective is met by writing a program to generate various non-periodic continuous signals.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views

Laboratory Experiment No. - : Generation of Continuous Signal (Analysis of Controlled System 2)

This MATLAB program generates six different continuous time signals: a unit step function, ramp function, sinusoidal function, triangular waveform, sawtooth waveform, and sinc function. The program defines a time vector t, then uses if/else statements and built-in MATLAB functions like sin, sawtooth, and sinc to calculate each signal over t and plot the results in a 2x3 subplot. The objective is met by writing a program to generate various non-periodic continuous signals.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Generation 

of Continuous Signal 
(Analysis of Controlled System 2) 
Laboratory Experiment No. __ 
 
 
 
Performance Objective 
 
To write a “MATLAB” Program to generate a non periodic  continuous time signals like  
 unit step, sawtooth, triangular, Sinusoidal, ramp, and sinc function. 
 
Materials and Equipment 
 
MATLAB software with Tool Box 
Personal Computer 
 
Procedure 
 Open MATLAB 
 Open new M‐file 
 Type the program 
 Save in current directory 
 Compile and Run the program  
 
PROGRAM: 
 
clc; 
Clear all; 
Close all; 
t=‐10:0.01:10; 
L=length(t); 
for i=1:L 
    %to generate unit Step and ramp function 
    if t(i)<0  
        x1(i)=0; 
        x2(i)=0; 
    else 
        x1(i)=1; 
        x2(i)=t(i); 
    end;   
end; 
%to generate sinusoidal function 
f=0.1; 
x3=sin(2*pi*f*t); 
%to generate Triangular and Sawtooth waveforms 
x4=sawtooth(t,0.5); 
x5=sawtooth(t); 
 
%to generate sinc function 
x6=sinc(t); 
figure; 
subplot(2,3,1); 
plot(t,x1); 
xlabel('t‐‐‐>');ylabel('amp‐‐‐>'); 
title('unit step'); 
subplot(2,3,2); 
plot(t,x2); 
xlabel('t‐‐‐>');ylabel('amp‐‐‐>'); 
title('unit ramp'); 
subplot(2,3,3); 
plot(t,x3); 
xlabel('t‐‐‐>');ylabel('amp‐‐‐>'); 
title('sinusoidal'); 
subplot(2,3,4); 
plot(t,x4); 
xlabel('t‐‐‐>');ylabel('amp‐‐‐>'); 
title('triangular'); 
subplot(2,3,5); 
plot(t,x5); 
xlabel('t‐‐‐>');ylabel('amp‐‐‐>'); 
title('sawtooth'); 
subplot(2,3,6); 
plot(t,x6); 
xlabel('t‐‐‐>');ylabel('amp‐‐‐>'); 
title('sinc function'); 
 
What are the different signals that you have generated after running the 
program?______________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________________
______________________________________________________ 
 
Kindly draw the output of matlab in the given space below. 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Analysis and Conclusion 
______________________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________________
_________________________________________________________________________________ 
 
 

You might also like