how to calculate the derivative of a matrix

9 views (last 30 days)
I have 2 huge data as 2 separate matrixes which gives me a graph.I want to calculate the derivative of the graph at the maxmum and draw the tangent line .
  4 Comments
Rik
Rik on 9 Dec 2022
And what code did you try to determine the derivative?
Jan
Jan on 9 Dec 2022
The tangent at the maximum is horizontal. So you do not need the derivative.

Sign in to comment.

Answers (1)

Rik
Rik on 9 Dec 2022
Jan has all but given you the function you should be using: the max function.
S=load(websave('data.mat','https://www.mathworks.com/matlabcentral/answers/uploaded_files/1225492/load%20depth.mat'));
depth01=S.depth01;
load01=S.load01;
plot(depth01 , load01 , "g")
[max_load,max_ind]=max(load01);
max_depth=depth01(max_ind);
hold on,plot(max_depth,max_load,'r*'),yline(max_load,'r'),hold off
  7 Comments
Rik
Rik on 10 Dec 2022
If you needed to calculate the slope of those positions by hand, how would you do that?
soheil zare
soheil zare on 10 Dec 2022
by hand it woud not be accurate but by fomula it is ( lim dLoad/dDepth when Load goes to Load max ).
anyway by ahand it would be like the red line tangent to the selected part of thr graph which is uploaded .

Sign in to comment.

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!