how Slope of a line?

I have plotted data and i want to obtain the gradient of the different sections of the line plot.How do i obtain the slope for the similar sections for
t=[ 1 2 3 4 5 6];
v=[10 25 30 40 45 50];
plot(t,v)

Answers (1)

Azzi Abdelmalek
Azzi Abdelmalek on 17 Nov 2013
Edited: Azzi Abdelmalek on 17 Nov 2013
diff(v)./diff(t)

2 Comments

Masilani
Masilani on 21 Nov 2013
Edited: Masilani on 21 Nov 2013
i want to obtain the slope by separating it 2 sections.Instead of obtaining 4 answers,just limit them to 2
What sections do you want? You can extract sections like this:
section1 = v(index1:index2);
where you, of course, specify the starting and ending indices of the section you want to extract.

Sign in to comment.

Categories

Tags

Asked:

on 17 Nov 2013

Commented:

on 21 Nov 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!