This document generates and plots four different discrete time signals: an impulse sequence, a step sequence of length 4, a ramp sequence of length 6, and an exponential sequence of length 6. It takes user input for the lengths of the ramp and exponential sequences and the value of the exponential sequence. It then plots the four signals as stem plots in a 2x2 subplot with labeled x- and y-axes.
1 of 2
Download to read offline
More Related Content
Generation of discrete time signals
1. GENERATION OF DISCRETE TIME SIGNALS
clc;
clear all;
close all;
n=input('enter the length of step sequence');
n1=input('enter the length of ramp sequence');
n2=input('enter the length of exponential sequence');
a=input('enter the value');
t=-2:1:2;
y=[zeros(1,2),ones(1,1),zeros(1,2)];
subplot(2,2,1);
stem(t,y);
xlabel('A(n)-->impulse sequence');
ylabel('amplitude');
t=0:n-1;
y1=ones(1,n);
subplot(2,2,2);
stem(t,y1);
xlabel('B(n)----->step sequence');
ylabel('amplitude');
t=0:n1;
subplot(2,2,3);
stem(t,t);
xlabel('C(n)---->ramp sequencccce');
ylabel('amplitude');
t=0:1:n2;
e=exp(t);
subplot(2,2,4);
stem(t,e);
xlabel('D(n)----->exponential sequence');
ylabel('amplitude');
OUTPUT
enterthe lengthof stepsequence4
enterthe lengthof ramp sequence6
enterthe lengthof exponentialsequence6
enterthe value6