Saturday, June 25, 2011

MATLAB Programs 01: Generating a ramp signal/sequence


Below given is a program to generate a ramp signal. The program is almost self explanatory.

% Program to generate a ramp signal

n=input('Enter the length of ramp sequence N = ');  % Get the length
s=input(' Enter the slop of the ramp S = ');  % Get the slop of the ramp
t=0:n-1;
plot(t,s*t);
ylabel ('Amplitude');
xlabel ('Time  Index');
TITLE ('Ramp signal');



This time you may try yourself by replacing plot() with stem();

4 comments:

Anonymous said...

Great Job Anil, your post is really helpful!

Anonymous said...

what if they ask ramp sequence with samples of 100 and sampling rate of 20kHz?

আগোছালো হিজিবিজি said...

Excellent boss (y).. it's really helpful

Anonymous said...

nice

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | coupon codes