I have plotted a graph in matlab with:
plot(x,y)
and my graph has different slopes, how do i draw tangents on each slope and calculate the coefficient for the slope?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you don’t have an explicit function for the plotted points, you can use finite differences for estimating the derivative. The following is appropriate for points not on the border of the data span:
Now drawing that slope, it depends on what you want: just a short line:
or a longer line
I’m pretty sure there’re no bugs in this code, but I’ll test it out when I have matlab around 😉