필터 지우기
필터 지우기

finding the gradient of a graph between two points.

조회 수: 3 (최근 30일)
Phillip Addison
Phillip Addison 2012년 7월 5일
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
Luffy
Luffy 2012년 7월 5일
편집: Luffy 2012년 7월 5일
Then between which two points do you want to calculate slope as it should vary on the basis of points u choose
Phillip Addison
Phillip Addison 2012년 7월 5일
between 3 and 3.5 on x axis.

댓글을 달려면 로그인하십시오.

채택된 답변

Luffy
Luffy 2012년 7월 5일
편집: Luffy 2012년 7월 5일
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));
  댓글 수: 9
Ryan
Ryan 2012년 7월 5일
편집: Ryan 2012년 7월 5일
It looks like there are no voltage values equal to 3 or 3.5. This method relies on there being a value in voltage exactly equal to the values you set.
Phillip Addison
Phillip Addison 2012년 7월 5일
found my problem your answer was right.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by