Experiment No. 9 (Sampling in MATLAB) : All 'Enter The Value of FM: '
Experiment No. 9 (Sampling in MATLAB) : All 'Enter The Value of FM: '
)
Roll No. 10
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);
');
: ');
: ');
: ');
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]);