how do i find the roots of this function? the function is attached

1 次查看(过去 30 天)
x=-10:1:10;
y=x.^3-x.^2+5.*x.*sin((pi().*x)/4-(pi()*5)/4)+3;
y1=0;
plot(x,y,x,y1)
xlabel('x'); grid on
ylabel('y')

回答(2 个)

Azzi Abdelmalek
Azzi Abdelmalek 2016-8-12
编辑:Azzi Abdelmalek 2016-8-12
syms x
y=x^3-x^2+5*x*sin(pi*x/4-5*pi/4)+3
solve(y)
To find all the roots, you can use fsolve
y=@(x) x^3-x^2+5*x*sin(pi*x/4-5*pi/4)+3
x0=-0.5 % first starting point
x1=fsolve(y,x0)
x0=2 % second starting point
x2=fsolve(y,x0)
  2 个评论
Sebastian Arias
Sebastian Arias 2016-8-12
i do not have any add-ons to matlab. just the base student edition. for the fsolve i need optimization toolbox

请先登录,再进行评论。


Torsten
Torsten 2016-8-15
编辑:Torsten 2016-8-15
Plot the function and use "fzero" to determine the roots with appropriate starting intervals taken from your graphical inspection.
Best wishes
Torsten.

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by