You are on page 1of 8

EXPONENTIAL SIGNALS

ANKUSH GUPTA R.No.- 12EJCEC034

Q. Write a program in MATLAB for the following discrere time signals 1) unit impulse
5) sine signal
2) unit step
6) exponential signal
3) ramp signal
7) signum function
4) cosine signal
8) rectangular signal
Ans.
Unit Impulse
>> %unit impulse
>> n=-5:1:5;
>> y=[zeros(1,5),ones(1,1),zeros(1,5)];
>> subplot(2,4,1)
>> stem(n,y)
>> xlabel('time')
>> ylabel('amplitude')
>> title('unit impulse')

ANKUSH GUPTA R.No.- 12EJCEC034

Unit Step
>> %unit step
>> n=-1:1:5;
>> y=[zeros(1,1),ones(1,6)];
>> subplot(2,4,2)
>> stem(n,y)
>> xlabel('time')
>> ylabel('amplitude')
>> title('unit step')

Ramp Signal
>> %ramp
>> n=0:5;
>> y=n;
>> subplot(2,4,3)
>> stem(n,y)
>> xlabel('time')
>> ylabel('amplitude')
>> title('ramp signal')

Exponential Signal
>>%exponential
>> n=-5:0.1:5;
>> y=exp(n);
>> subplot(2,4,6)
>> stem(n,y)
>> xlabel('time')
>> ylabel('amplitude')
>> title('exponential')

Cos Signal
>>%cos signal
>> n=-pi:0.1:pi;
>> y=cos(n);
>> subplot(2,4,4)
>> stem(n,y)
>> xlabel('time')
>> ylabel('amplitude')
>> title('cos signal')
Signum Function
>>%signum
>> n=-5:1:5;
>> y=[-ones(1,5),ones(1,6)];
>> subplot(2,4,7)
>> stem(n,y)
>> xlabel('time')
>> ylabel('amplitude')
>> title('signum function')

ANKUSH GUPTA R.No.- 12EJCEC034

Sine Signal
>>%sine signal
>> n=0:0.1:2*pi;
>> y=sin(n);
>> subplot(2,4,5)
>> stem(n,y)
>> xlabel('time')
>> ylabel('amplitude')
>> title('sin signal')

Rectangular Signal
>>%rectangular
>> n=-0.5:0.1:0.5;
>> y=[ones(1,11)];
>> subplot(2,4,8)
>> stem(n,y)
>> xlabel('time')
>> ylabel('amplitude')
>> title('rectangular signal')

Q. Write a program in MATLAB for the following exponential time signals


3) cos( t)cos(10 t)
1) e-tsin (t)
2) sin( t)sin(10 t)

4) sin( t)+cos(10 t)

Ans.
e-tsin (t)

>> t=-pi:0.1:pi;
>> y=[exp(-t).*sin(pi*t)];
>> subplot(2,2,1)
>> plot(t,y)
>> xlabel('time')
>> ylabel('amplitude')
>> title('exp(- t)sin( t)')

sin( t)sin(10 t)
>> t=-1:0.1:1;
>> y=[sin(pi*t).*sin(10*pi*t)];
>> subplot(2,2,2)
>> plot(t,y)
>> xlabel('time')
>> ylabel('amplitude')
>> title('sin( t)sin(10 t')

ANKUSH GUPTA R.No.- 12EJCEC034

sin( t)+cos(10 t)
>> t=-1:0.1:1;
>> y=[sin(pi*t)+cos(10*pi*t)];
>> subplot(2,2,3)
>> plot(t,y)
>> xlabel('time')
>> ylabel('amplitude')
>> title('sin( t)+cos(10 t)')
cos( t)cos(10 t )
>> t=-1:0.1:1;
>> y=[cos(pi*t).*cos(10*pi*t)];
>> subplot(2,2,4)
>> plot(t,y)
>> xlabel('time')
>> ylabel('amplitude')
>> title('cos( t)cos(10 t)')

Q. Write a program in MATLAB for the following continuous time signals


1) unit impulse
5) sine signal
2) unit step
6) exponential signal
3) ramp signal
7) signum function
4) cosine signal
8) rectangular signal
Ans.

Unit Impulse
>>%unit impulse
>>t=-5:1:5;
>>y=[zeros(1,5),ones(1,1),zeros(1,5)];
>>subplot(2,4,1)
>>plot(t,y)
>>xlabel(time)
>>ylabel(amplitude)
>>title(unit impulse)

ANKUSH GUPTA R.No.- 12EJCEC034

Unit Step
>>%unit step
>>t=-2:1:8;
>>y=[zeros(1,2),ones(1,9)];
>>subplot(2,4,2)
>>plot(t,y)
>>xlabel(time)
>>ylabel(amplitude)
>>title(unit step)

Cosine Signal
>>%cos signal
>>t=-pi:0.1:pi;
>>y=cos(t);
>>subplot(2,4,4)
>>plot(t,y)
>>xlabel(time)
>>ylabel(amplitude)
>>title(cosine signal)

Sine Signal
>>%sin signal
>>t=-pi:0.1:pi;
Y=sin(t);
>>subplot(2,4,5)
>>plot(t,y)
>>xlabel(time)
>>ylabel(amplitude)
>>title(sin signal)

Signum Function
>>%signum
>>t=-5:1:5;
Y=[-ones(1,5),ones(1,6)];
>>subplot(2,4,6)
>>plot(t,y)
>>xlabel(time)
>>ylabel(amplitude)
>>title(signum function)

Rectangular Signal
>>%rectangular
>>t=-0.5:0.1:0.5;
>>y=[ones(1,11);
>>subplot(2,4,8)
>>plot(t,y)
>>xlabel(time)
>>ylabel(amplitude)
>>title(rectangular signal )

Ramp Signal
>>%ramp signal
>>t=0:1:6;
>>y=t;
>>subplot(2,4,3)
>>plot(t,y)
>>xlabel(time)
>>ylabel(amplitude)
>>title(unit impulse)
Exponential Signal
>>%exponential
>>t=-4:0.5:4;
>>Y=exp(t);
>>subplot(2,4,7)
>>plot(t,y)
>>xlabel(time)
>>ylabel(amplitude)
>>title(exponential signal)

ANKUSH GUPTA R.No.- 12EJCEC034

CONTINUOUS SIGNALS

ANKUSH GUPTA R.No.-12EJCEC034

DISCRETE SIGNALS

ANKUSH GUPTA R.No.-12EJCEC034

You might also like