plot six hyperbolic trigonometric functions. theta begins at -2 and ends at 2 with 101 elements in matlab

You can use the linspace function to create an array of 101 equally-spaced values of theta from -2 to 2, and then calculate the values of the six hyperbolic trigonometric functions (sinh, cosh, tanh, csch, sech, and coth) for each element of theta. Finally, use the plot function to plot the values of each function against theta. Here's the code:

main.m
theta = linspace(-2, 2, 101);
y1 = sinh(theta);
y2 = cosh(theta);
y3 = tanh(theta);
y4 = csch(theta);
y5 = sech(theta);
y6 = coth(theta);
plot(theta, y1, theta, y2, theta, y3, theta, y4, theta, y5, theta, y6);
legend('sinh', 'cosh', 'tanh', 'csch', 'sech', 'coth');
xlabel('\theta');
284 chars
11 lines

This will plot all six functions on the same graph, with a legend specifying which function corresponds to which line. The xlabel function adds a label to the x-axis to indicate that the horizontal axis represents theta.

gistlibby LogSnag