# finding the gradient of a graph between two points.

2 views (last 30 days)
Phillip Addison on 5 Jul 2012
Hi I have imported some data from excell and have plotted a graph from 2 columns of data. I need to find the gradient of the graph between two points, not the gradient of the whole graph because I am using data from semiconductors which properties change as the voltage increases.
Here is my code
%%%%%%%%%%%%%%% variables %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
voltage = data (:,1);
current = data (:,2);
current_density = data (:,3);
LED_power = data (:,4);
LEDPower_density = data (:,5);
Corrected = data (:,6);
droop_model = data (:,7);
electron_charge= 1.6E-19;
boltzman_constant = 1.3806503E-23;
temperature = 300;
constant = (electron_charge / (boltzman_constant*temperature));
F = plot(voltage,current);
##### 2 CommentsShow 1 older commentHide 1 older comment
Phillip Addison on 5 Jul 2012
between 3 and 3.5 on x axis.

Luffy on 5 Jul 2012
Edited: Luffy on 5 Jul 2012
i=find(voltage==3); % this gives index of 3 in voltage vector to calculate corresponding current value at voltage = 3.
j=find(voltage==3.5);
slope = 2*(current(j)-current(i));
Phillip Addison on 5 Jul 2012