In: Computer Science
For all of the graphs below use a vector x ranging from 0 to 10 in steps of 0.1. Create two additional vectors using the following formulas: yp=x.^2.5 and ym=x.^(-2.5);
[1;2] Create the formula for the derivative of yp (apply the rules of calculus to the formula for yp). Plot yp versus x. Add a straight line at 3 points (at x = 3, 5, 8) with the slope of the line (determined from the derivative) showing that the derivative is the slope of a tangent line at the indicated points.
clc%clears screen
clear all%clears history
close all%closes all files
format long
x=0:0.1:10;
yp=x.^2.5;
g=@(x) 2.5*x.^1.5;
f=@(x) x.^2.5;
xx=2:0.1:9;
y1=f(3)+(xx-3)*g(3);
y2=f(5)+(xx-5)*g(5);
y3=f(8)+(xx-8)*g(8);
plot(x,yp,xx,y1,xx,y2,xx,y3);