>> [z,x]=tlroots(1000,1:100);
Look at roots.his for additional information and error messages.
>> x = rand(1,1001); % A 1,000 degree polynomial. >> [r,p]=broots(x); % Factor it. iterativeDeflation needs to find 0 missing roots. Return code=0 Error=7.9714e-014. >> v=unfactor(p,1); >> polycmp(x,v) % Compare the unfactored roots with the original polynomial. ans = 9.8144e-014
>> [z,e] = lroots(x); % Factor it. e is used for unwrapz. >> u = unfactor(z,1); % Unfactor the roots. >> polycmp(x,u) % Compare the unfactored roots with the original polynomial. ans = 9.4480e-014
>> [ph,amp,err]=unwrapz(x,z,e);
>> p1 = unwrapph(x);
>> k = 1:length(p1); >> plot(k,p1,k,ph); >> plot(ph-p1); % Should be small multiples of 2*pi. Ideally it is identically 0.
» z=lroots(x); » length(find(abs(z)<1)) % The exact number of roots inside the unit circle. ans = 485 » nroots(x,1) % Approximately, the number of roots inside the circle of radius 1. ans = 485