can someone help me debug this code to plot the graph of a function and its derivative?
Info
This question is closed. Reopen it to edit or answer.
Show older comments
clc
clear all
syms y x
x=linspace(-2,4,100);
y=3*x.^3-26*x+10
dy=diff(y,x)
ddy=diff(dy,x)
plot(x,y,x,dy,x,ddy)
Answers (1)
Steven Lord
on 29 Oct 2018
You define a symbolic variable x and then immediately overwrite it with a numeric vector.
syms y x
x=linspace(-2,4,100);
Name this vector something else and use subs to substitute it in place of x in the expressions y, dt, and ddy when you want to plot them.
1 Comment
Reghunaath A A
on 29 Oct 2018
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!