help with analysis of equations

1 次查看(过去 30 天)
jessica
jessica 2013-7-24
if true
fplot('x^2-5*x*sin(3*x)+3',[0,10]);
disp('positive roots of the equation are')
x1=fzero('x^2-5*x*sin(3*x)+3',2)
x2=fzero('x^2-5*x*sin(3*x)+3',2.7)
end
determine the positive roots of the equation
x^2-5*x*sin(3*x)+3
2.3656
2.8435
I keep getting this two and my book says there should be 4 3.8;3.4;1.8;1.3

回答(1 个)

Narges M
Narges M 2013-7-24
Try this:
if true
fplot('x^2-5*x*sin(3*x)+3',[0,10]);
disp('positive roots of the equation are')
hold on;
plot(0:10,zeros(1,11), '--c');
x1=fzero('x^2-5*x*sin(3*x)+3',2)
x2=fzero('x^2-5*x*sin(3*x)+3',2.7)
plot(x1,0,'rX', 'MarkerSize',8);
plot(x2,0,'rX', 'MarkerSize',8);
end
As you see, this function only has these roots, and is different from the one in your book.

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by