Professional Documents
Culture Documents
Communication
Communication
Communication
clear all;
close all;
clc;
t = 0:0.001:0.3 ;
x = sin(2*pi*10*t) ;
plot(t,x);
fs = [20 50 100 200] ;
l = length(fs) ;
for i = 1:l
Ts = 1/fs(i) ;
ts = 0:Ts:0.3 ;
xs = sin(2*pi*10*ts) ;
subplot(2,2,i), stem(ts,xs);
clear ts ;
clear xs ;
end
reconsructionofsignal.m
clear all;
close all;
clc;
t = 0:0.001:0.3;
x = sin(2*pi*10*t);
plot(t,x);
fs = [20 50 100 200];
l = length(fs);
for i = 1:l
Ts = 1/fs(i) ;
ts = 0:Ts:0.3 ;
xs = sin(2*pi*10*ts) ;
y = interp1(ts,xs,t) ;
subplot(2,2,i), plot(t,y);
clear ts ;
clear xs ;
end
exp
clear all;
close all;
clc;
t = 0:0.001:0.35 ;
% x = sin(2*pi*10*t) + sin(2*pi*50*t) + sin(2*pi*100*t) ;
x=cos(2*pi*10)+2+sin(2*pi*20);
plot(t,x) ;
fs = [ 10 50 500 1000 2000 750] ;
l = length(fs);
for i = 1:l
Ts = 1/fs(i) ;
ts = 0:Ts:0.35 ;
xs = cos(2*pi*10*ts)+2+sin(2*pi*20*ts) ;
y = interp1(ts,xs,t) ;
subplot(3,3,i), plot(t,y);
clear ts ;
clear xs ;
clear y ;
end
code of 2/03/2023
clear all;
close all;
clc;
x1=[4 2 6 3 8 1 5];
n1=[-2:4];% generating index
x2=[3 8 6 9 6 7];
n2=[-4:1];
kmin=n1(1)+n2(1);% left edge of convolved result
kmax=n1(end)+n2(end); % right edge of convolved result
y=conv(x1,x2);
k=kmin:kmax; % generating index of the result
subplot(311),stem(n1,x1)
subplot(312),stem(n2,x2)
subplot(313),stem(k,y)