ii = index of the point where you want to get the tangent
x1 = left bound of your tangent
x2 = right bound of your tangent
xT = z(ii,1) %argument where you want to get the tangent
yT = z(ii,2) %corresponding y
mT = tan(z(ii,3)) % corresponding slope
I assume you just want one tangent, then plot it like this.
plot( [x1,xT,x2] , [yT-mT*(xT-x1), yT, yT+mT*(x2-xT)] )
Otherwise just use a loop for more tangents using ii
as iteration variable.
The string for your equation would be
eq = strcat('y = ',num2str(mT),'*x + ',num2str(yT-mT*xT))