Date:-Programme No.2 Aim: - To Generate A Rectangular Pulse
Date:-Programme No.2 Aim: - To Generate A Rectangular Pulse
Programme No.2
>> t=-1:1/500:1;
>> u1=[zeros(1,250),ones(1,751)];
>> u2=[zeros(1,751),ones(1,250)];
>> u=u1-u2;
>> plot(t,u)
>> axis([-1 1 -1 2])
>> xlabel('time')
>> ylabel('amplitude')
>> title('waveform of rectangular pulse')
Output waveform of programme no.-2
1.5
1
de
pli
m
tu
a
0.5
-0.5
-1
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
time
Date:-
Programme No.3.1
>> t=0:1/500:2;
>> u=[zeros(1,1),ones(1,1000)];
>> plot(t,u)
>> axis([-1 3 -1 2])
>> xlabel('time')
>> ylabel('amplitude')
>> title('waveform of continuous time step signal')
Output waveform of programme no.-3.1
Waveform of continuous time step
2 signal
1.5
1
de
pli
m
tu
a
0.5
-0.5
-1
-1 -0.5 0 0.5 1 1.5 2 2.5 3
time
Date:-
Programme No.3.2
>> rho=1;
>> x=A*square(omega*n+rho);
>> stem(n,x)
>> axis([-11 11 -2 2])
>> xlabel('time')
>> ylabel('amplitude')
>> title('waveform of discrete time signal')
1.5
0.5
amplitude
-0.5
-1
-1.5
-2
-10 -8 -6 -4 -2 0 2 4 6 8 10
time
Date:-
Programme No.4.2
>> B=1;
>> r=0.85;
>> n=-10:1:10;
>> x=B*r.^n;
>> stem(n,x)
>> axis([-12 12 -2 8])
>> xlabel('time')
>> ylabel('amplitude')
>> title('waveform of exponential signal in discrete time')
Output waveform of programme no.-4.2
4
amplitude
-1
-2
-10 -5 0 5 10
time
Date:-
Programme No.4.1
>> B=5;
>> a=6;
>> t=0:1/1000:1;
>> x=B*exp(a*t);
>> plot(t,x)
>> axis([-1 2 -1 2500])
>> xlabel('time')
>> ylabel('amplitude')
>> title('waveform of exponential signal in continuous time')
Output waveform of programme no.-4.1
waveform of exponential signal in continuous time
2500
2000
1500
amplitude
1000
500
0
-1 -0.5 0 0.5 1 1.5 2
time
Date:-
Programme No.5
>> x=ones(1,10);
>> h=ones(1,5);
>> n=2:1:15;
>> y=conv(x,h);
>> stem(n,y)
>> axis([-1 8 -1 8])
>> xlabel('time')
>> ylabel('amplitude')
>> title('waveform of convolution of two signal')
Output waveform of programme no.5
waveform of convolution of two signal
8
5
amplitude
-1
-1 0 1 2 3 4 5 6 7 8
time
Date:-
Programme No.6.2
>> A=1;
>> B=5;
>> r1=0.85;
>> r2=0.15;
>> n=-10:1:10;
>> x=B*r1.^n;
>> y=A*r2.^n;
>> z=x+y;
>> stem(n,z)
>> axis([-11 11 -1 19])
>> xlabel('time')
>> ylabel('amplitude')
>> title('waveform for addition of two signal in discrete time')
Output waveform of programme no.6.2
18
16
14
12
amplitude
10
-10 -8 -6 -4 -2 0 2 4 6 8 10
time
Date:-
Programme No.6.1
3
amplitude
-1
-1 0 1 2 3 4 5 6
time
Date:-
Programme No.8
>> d=randint(3,5,[0,10])
d= 8 10 3 10 10
9 6 6 1 5
2 10 10 8 9