Generate sequence of different waveform using MATLAB


AIM: To generate sequence of different signals and to perform several operations on signals using MATLAB simulator.

SOFTWARE USED: MATLAB

TASK : Generate the following signals using MATLAB

     Unit step

     Unit ramp

     Exponential

     Sinusoidal 

            Exponential


TASK LOGIC: This example shows how to generate widely used periodic and aperiodic waveforms. For plotting the required sequence we have to first create an array of 1’s using ones() command and an array of vectors (n) also. After this using proper alignment of array of 1’s and array of vector values (n) we can create any of the above mentioned sequence.

 Plotting Unit step, Unit ramp, Exponential and Sinusoidal sequence:

 CODE:

clc;

clear all;

close all;

N=21;

x=ones(1,N);

n=0:1:N-1;

subplot(2,2,1);

stem(n,x); %Plotting Unit step function

xlabel('n');

ylabel('x(n)');

title('unit step sequence');

subplot(2,2,2);

ramp=n.*x;

stem(n,ramp); %Plotting ramp signals

xlabel('n');

ylabel('x1(n)');

title('ramp sequence');

x2=.8.^(n);

subplot(2,2,3);

stem(n,x2); %Plotting exponential sequence

xlabel('n');

ylabel('x2(n)');

title('exponential sequence');

x3=cos(.1*pi*n);

subplot(2,2,4);

stem(n,x3); %Plotting sinusoidal sequence

xlabel('n');

ylabel('x3(n)');

title('sinusoidal sequence');


OUTPUT:

 

 

Plotting Impulse signal

CODE:

clc

clear all

close all

n=-4:4;

delta_n=[0,0,0,0,1,0,0,0,0];

stem(n,delta_n);

ylabel('Amplitude');

xlabel('n');

title('Impulse signal');

OUTPUT:

RESULT: Hence, we have generated the Unit step sequence, Unit ramp sequence, Exponential sequence, Sinusoidal sequence and Unit impulse sequence successfully using MATLAB.






Thanks for Reading!

Written by:  Mukul Kumar


 

 


Comments

Post a Comment

Popular posts from this blog

Smart Parking System Using Arduino Uno

Phishing Attack using SETOOLKIT in Kali Linux