basics signal plot in matlab

4
MIS No.141305012 Name:-Bhamare Kishor D. Batch:-D 1) Program to Create Unit Impulse Signal in Matlab clc; clear all; t=-20:0.01:20; f=zeros(1,4001); for i=1:4001; if (t(i)==0) f(i)=1; else f(i)=0; end; end; plot(t,f);

Upload: kishor-bhamare

Post on 24-Dec-2015

6 views

Category:

Documents


0 download

DESCRIPTION

unit step,ramp,parabolic signal pliot in matlab

TRANSCRIPT

Page 1: Basics Signal Plot in Matlab

MIS No.141305012

Name:-Bhamare Kishor D.

Batch:-D

1) Program to Create Unit Impulse Signal in Matlab

clc;

clear all;

t=-20:0.01:20;

f=zeros(1,4001);

for i=1:4001;

if (t(i)==0)

f(i)=1;

else

f(i)=0;

end;

end;

plot(t,f);

Page 2: Basics Signal Plot in Matlab

Program to Create Unit Step Signal in Matlab

clc;

clear all;

t=-20:0.01:20;

f=zeros(1,4001);

for i=1:4001;

if (t(i)>0)

f(i)=1;

else

f(i)=0;

end;

end;

plot(t,f);

Program to Create Ramp Signal in Matlab

clc;

clear all;

t=-20:0.01:20;

f=zeros(1,4001);

for i=1:4001;

if (t(i)<0)

f(i)=0;

else

Page 3: Basics Signal Plot in Matlab

f(i)=t(i);

end;

end;

plot(t,f);

axis([-20 20 -5 30]);

grid on;

Program to Create Parabolic Signal in Matlab

clc;

clear all;

t=-20:0.01:20;

f=zeros(1,4001);

for i=1:4001;

if (t(i)<0)

f(i)=0;

else

f(i)=((t(i))^2)/2;

end;

end;

plot(t,f);

axis([-25 25 -5 500]);

grid on;

xlabel('Time(sec)');

Page 4: Basics Signal Plot in Matlab

ylebel('Magnitude');

Program to Create sine Function in Matlab

clc;

clear all;

t=-10:0.01:10;

f=sin(t);

plot(t,f);

grid on;

axis([-20 20 -2 2]);

xlabel('Time(sec)');

ylebel('Magnitude');