MATLAB: Roots of nonlinear eqn

MATLABnonlinear equationone unknownroots

I tried so many ways to find this question's roots, but I couldn't find it. Could you help me to find it,please?
y = -1200*x.^2*sin(1200*x) + x.*cos(1200*x).^2 – 2*x.*cos(1200*x) + x.*sin(1200*x).^2 + x

Best Answer

Well, you did come back and make an effort. There are infinitely many roots.
First though, fully use the . operators to get rid of those annoying warnings. You missed at least one.
fun = @(x) -1200*x.^2.*sin(1200*x) + x.*cos(1200*x).^2 - 2*x.*cos(1200*x) + x.*sin(1200*x).^2 + x;
ezplot(fun,[0,.01]),grid on
untitled.jpg
fzero(fun,0.005)
ans =
0.00523598775598288
WTP?
If you cannot figure out how to find a decent estimate of that first root, then try a Taylor series approximation. Use an expansion point someplace in that vicinity.
Yapprox = taylor(y,x,'order',15,'expansion',0.003);
vpa(vpasolve(Yapprox),15)
ans =
0.00523598465330524
0.00751869453910503
0.00953318487432745
0.00987708713167847
- 0.0015385284492191 + 0.00427836249361709i
- 0.0015385284492191 - 0.00427836249361709i
- 0.000770867501573772 - 0.00128010168392448i
- 0.000770867501573772 + 0.00128010168392448i
0.000154479476404463 + 0.000558172154407523i
0.000154479476404463 - 0.000558172154407523i
0.000389259331551612 - 0.000176673046991433i
0.000389259331551612 + 0.000176673046991433i
0.00934267887256653 + 0.00394573409659824i
0.00934267887256653 - 0.00394573409659824i
That first root listed is a splendidly good approximation to the first root. In fact, it even gave a pretty good approximation for the second root.