generation of discrete signals using matlab
Ajay U
23:00:00
download code in word format
download in matlab (.m)
download in matlab (.m)
%stored
in file generation of discrete signal.m
%dirac
delta function
clc;clear;clf;
r=2;c=3;
x=zeros(1,11);
x(6)=1;n=[-5:5];
subplot(r,c,1)
stem(n,x);
title('dirac delta function');
xlabel('n....>');
ylabel('amplitude');
%unit
step function
r=2;c=3;
xs=ones(11);
ns=0:length(xs)-1;
subplot(r,c,2)
stem(ns,xs)
title('unit step function');xlabel('n.....>');
ylabel('amplitude');
%discrete
sine function
t=0:0.02:1;f=1;
y=sin(2*pi*f*t);
N=0:length(t)-1;
subplot(r,c,3);
stem(N,y)
title('discrete sine function');
xlabel('n....>');
ylabel('amplitude')
%ramp
function
t1=0:0.5:5;
m =1.5;
y1=m*t1;
subplot(2,3,4);
stem(t1,y1);
title('ramp function'):xlabel('n...>');
ylabel('amplitude')
xlabel('n....>');
%triangular
function
n=10;
t1=0:1:n
m=2.5;
y1=m*t1
y2=y1(end)-m*t1
y=[y1 y2(2:end)];
t2=0:length(y)-1;
subplot(2,3,5);
stem(t2,y);
title('triangular
function');
ylabel('amplitude');
xlabel('n....>');
%sinc
function
subplot(2,3,6);
theta=(-3*pi):(pi/24):(3*pi);
y=ones(size(theta));
i=find(theta);
y=
(sin(theta(i)))./theta(i);
n=0:length(y)-1;
stem(n,y)
title('sinc function');
ylabel('amplitude');
Subscribe to:
Posts (Atom)
0 comments:
Post a Comment