0% found this document useful (0 votes)
44 views

Experiment No. 9 (Sampling in MATLAB) : All 'Enter The Value of FM: '

The document describes two MATLAB experiments: 1) Experiment 9 involves sampling a sine wave at different sampling frequencies to demonstrate the effects of sampling. The program generates a sine wave, then samples it at user-input frequencies and plots the results. 2) Experiment 10 demonstrates pulse-width modulation (PWM) in MATLAB. The program generates a sine wave and sawtooth wave, then compares them to create a PWM signal based on their relative amplitudes at each time step. It plots the original and PWM signals.

Uploaded by

pramod
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views

Experiment No. 9 (Sampling in MATLAB) : All 'Enter The Value of FM: '

The document describes two MATLAB experiments: 1) Experiment 9 involves sampling a sine wave at different sampling frequencies to demonstrate the effects of sampling. The program generates a sine wave, then samples it at user-input frequencies and plots the results. 2) Experiment 10 demonstrates pulse-width modulation (PWM) in MATLAB. The program generates a sine wave and sawtooth wave, then compares them to create a PWM signal based on their relative amplitudes at each time step. It plots the original and PWM signals.

Uploaded by

pramod
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Daniel Barboza (T.E. E.X.T.C.

)
Roll No. 10

Experiment No. 9 [Sampling in MATLAB]


Program:

clc;
clear all;
t = 0:0.001:1;
fm=input('Enter the value of fm :
x=sin(2*pi*fm*t);
subplot(4,1,1);
plot(t,x);
fs1=input('Enter the value of fs1
n=0:(1/fs1):1;
x=sin(2*pi*fm*n);
subplot(4,1,2);
stem(n,x);
fs2=input('Enter the value of fs2
m=0:(1/fs2):1;
x=sin(2*pi*fm*m);
subplot(4,1,3);
stem(m,x);
fs3=input('Enter the value of fs3
p=0:(1/fs3):1;
x=sin(2*pi*fm*p);
subplot(4,1,4);
stem(p,x);

');

: ');

: ');

: ');

Daniel Barboza (T.E. E.X.T.C.)


Roll No. 10

Experiment No. 10 [PWM in MATLAB]


Program:

clc;
clear all;
t = 0:0.001:1;
fm=input('Enter the value of fm : ');
x=sin(2*pi*fm*t);
subplot(3,1,1);
plot(t,x);
fsaw=input('Enter the value of fsaw : ');
y=sawtooth(2*pi*fsaw*t);
subplot(3,1,2);
plot(t,y);
n=length(y);
pwm=0;
for i=1:n
if x(i)>= y(i)
pwm(i)=1;
else
pwm(i)=0;
end
end
subplot(3,1,3);
plot(t,pwm);
axis([0 1 0 2]);

You might also like