from pc for lab 1

3
1 clc clear all t_end=.4 t=0:.0001:t_end; x=sin(20*pi*t+(pi/6)); plot(t,x); subplot(3,2,1); fs=20; ts=1/fs; t1=0:ts:t_end; x2=sin(20*pi*t+(pi/6)); stem(t1,x2); subplot(3,2,2) 2. clc; clear all; t_step=0.0001; t_end=0.2; t=0:t_step:t_end; x=sin(20*pi*t)+sin(100*pi*t)+sin(200*pi*t); plot(t,x), grid on %code for sampling fs=10; ts=1/fs;

description

eee

Transcript of from pc for lab 1

Page 1: from pc for lab 1

1

clc

clear all

t_end=.4

t=0:.0001:t_end;

x=sin(20*pi*t+(pi/6));

plot(t,x);

subplot(3,2,1);

fs=20;

ts=1/fs;

t1=0:ts:t_end;

x2=sin(20*pi*t+(pi/6));

stem(t1,x2);

subplot(3,2,2)

2. clc;

clear all;

t_step=0.0001;

t_end=0.2;

t=0:t_step:t_end;

x=sin(20*pi*t)+sin(100*pi*t)+sin(200*pi*t);

plot(t,x), grid on

%code for sampling

fs=10;

ts=1/fs;

t1=0:ts:t_end;

Page 2: from pc for lab 1

x1=sin(20*pi*t1+(pi/6));

stem(t1,x1), grid on

%interpolation(reconstruction of analog signal)

y=interp1(t1,x1,t);

plot(t,y),grid on

3. clc;

clear all;

t_step=0.0001;

t_end=0.1;

t=0:t_step:t_end;

x=(sin(20*pi*t)+sin(100*pi*t)+sin(200*pi*t));

subplot(3,1,1)

plot(t,x,'.'), grid on

xlabel('Figure 1:x(t)=sin(20*pi*t+30)')

%code for sampling

fs=500;

ts=1/fs;

t1=0:ts:t_end;

x1=(sin(20*pi*t1)+sin(100*pi*t1)+sin(200*pi*t1));

subplot(3,1,2)

stem(t1,x1), grid on

%interpolation(reconstruction of analog signal)

y=interp1(t1,x1,t);

plot(t,y),grid on

Page 3: from pc for lab 1

4.

clc;

clear all;

t_step=0.0001;

t_end=0.4;

t=0:t_step:t_end;

x=sin(20*pi*t+(pi/6));

plot(t,x), grid on

%code for sampling

fs=20;

ts=1/fs;

t1=0:ts:t_end;

x1=sin(20*pi*t1+(pi/6));

stem(t1,x1), grid on

%interpolation(reconstruction of analog signal)

y=interp1(t1,x1,t);

plot(t,y),grid on