1. REPRESENTATION OF BASIC SIGNAL


%program for the generation of unit impulse signal
t = -2:1:2;
y = [zeros(1,2), ones(1,1), zeros(1,2)];
subplot (2,2,1);
stem(t,y);
xlabel ('n --->');
ylabel('amplitude');
%program for the generation of unit step sequence [u(n)-u(n-N)]  
n=input('enter the N value');
t=0:n-1;
y1=ones(1,n);
subplot(2,2,2);
stem(t,y1);
ylabel('amplitude');
xlabel('n-->');
%program for the generation of a ramp sequence  
n1=input('enter the length of ramp sequence ');
t=0:n1;
subplot(2,2,3);
stem(t,t);
ylabel('amplitude');
xlabel('n-->');
%program for the generation of the exponential
 sequence
n2 =input ('enter the length of exponential sequence');
t= 0:n2;
a=input('enter the a value');
y2 = exp(a*t);
subplot(2,2,4);
stem (t,y2);
ylabel('amplitude');
xlabel('(a)n -->');
%program for the generation of sine sequence
t=0:.01:pi;
y=sin(2*pi*t);figure(2);
subplot(2,1,1);plot(t,y);ylabel('Amplitude');
xlabel('(a)n-->');
%program for the generation of cosine sequence 
t=0:.01:pi;
y=cos(2*pi*t);
subplot(2,1,2);plot(t,y);ylabel('Amplitude');
xlabel('(b)n-->');

RESULT

  enter the N value                                             10
  enter the length of ramp sequence               10
  enter the length exponential sequence         10
  enter the a value                                              10

matlabprograms

matlabprograms


No comments:

Post a Comment