Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

Program-To generate ramp signal

t=0:10;
y=t;
plot(t,y);
ylabel ('Amplitude');
xlabel ('Time Index');
title ('Ramp signal');
Ramp signal
10
9
8

Amplitude

7
6
5
4
3
2
1
0

5
6
Time Index

10

Program-To generate step signal


N=21;
y=ones(1,N);
t=0:1:N-1;
plot(t,y);
xlabel('t'),ylabel('y');
stem(t,y);
title('unit step signal);
unit step signal
1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0

10

12

14

16

18

20

Program-To generate impulse signal


t=-4:1:4;
y=[zeros(1,4),1,zeros(1,4)];
stem(t,y);
xlabel('t'),ylabel('y');
title('unit impulse signal');

unit impulse signal


1
0.9
0.8
0.7

0.6
0.5
0.4
0.3
0.2
0.1
0
-4

-3

-2

-1

0
t

Program-To generate exponential signal


t=(0:0.001:1);
y=t.^2;
plot(t,y);
xlabel('t');
ylabel('y');
title('exponential signal');
exponential signal
1
0.9
0.8
0.7

0.6
0.5
0.4
0.3
0.2
0.1
0

0.1

0.2

0.3

0.4

0.5
t

0.6

0.7

0.8

0.9

Program-To generate amplitude modulated signal


Fs = 8000; % Sampling rate is 8000 samples per second.
Fc = 300; % Carrier frequency in Hz
t = [0:.1*Fs]'/Fs; % Sampling times for .1 second
x = sin(20*pi*t); % Representation of the signal
y = ammod(x,Fc,Fs); % Modulate x to produce y
subplot(2,1,1); plot(t,x); % Plot x on top.
subplot(2,1,2); plot(t,y)% Plot y below.
1
0.5
0
-0.5
-1

0.01

0.02

0.03

0.04

0.05

0.06

0.07

0.08

0.09

0.1

0.01

0.02

0.03

0.04

0.05

0.06

0.07

0.08

0.09

0.1

1
0.5
0
-0.5
-1

Program-To generate frequency modulated signal


fc=400;
fm=25;
m=10;
t=0:0.0001:0.1;
c=sin(2*pi*fc*t);%carrier signal
M=sin(2*pi*fm*t);% modulating signal
subplot(3,1,1);plot(t,c);
ylabel('amplitude');xlabel('time index');title('Carrier signal');
subplot(3,1,2);plot(t,M);
ylabel('amplitude');xlabel('time index');title('Modulating signal');
y=cos(2*pi*fc*t+(m.*sin(2*pi*fm*t)));
subplot(3,1,3);plot(t,y);
ylabel('amplitude');xlabel('time index');title('Frequency
Modulated signal');

amplitude

amplitude

amplitude

Carrier signal
1
0
-1

0.01

0.02

0.03

0.01

0.02

0.03

0.01

0.02

0.03

0.04 0.05 0.06


time index
Modulating signal

0.07

0.08

0.09

0.1

0.04 0.05 0.06 0.07


time index
Frequency Modulated signal

0.08

0.09

0.1

0.08

0.09

0.1

1
0
-1

1
0
-1

0.04 0.05 0.06


time index

0.07

You might also like