Hi I have written a m file in which I'm trying to find ROOTs of a polynomial of of 6'th degree.I do this in a cycle using "do" because a parameter in the coefficients of the polynomial have to change in each step and the ROOTs should be calculated and saved for further mathmatical calculations. The problem is that in this exact case of mine the real part of each root is very small so that matlab ignores them in some steps and doesnt ignore in other cases(by cases I mean change of that parameter).and this cause the results to oscillate.I know that this real part despite it's smallness is'nt zero. HOW CAN I INCREASE THE PRECISION IN THIS EXACT CASE? thanks for your attention.

 Réponse acceptée

Walter Roberson
Walter Roberson le 17 Nov 2011

2 votes

If the function uses its own precision, then we would need to see the function in order to see how to increase the precision. There is not just one method for doing extended precision calculations.
If you have access to the symbolic toolbox, consider using that for the calculations.
Note: in any finite precision calculation scheme, there are calculations that will oscillate in the manner you describe.

4 commentaires

Atta Oveisi
Atta Oveisi le 18 Nov 2011
thanks and yes I have access to symbolic toolbox.I will try it.
Walter Roberson
Walter Roberson le 18 Nov 2011
In theory, MuPAD should be able to provide numeric solutions for 6th degree polynomials, to any desired precision according to the Digits setting. In practice, I have seen a number of cases where it left the polynomials in symbolic form and said that was the best it could do; there is some evidence that in one of the most recent MATLAB releases that that situation might have been greatly improved.
Try
roots(conv(conv([1 -2 1],[1 -2 1]),[1 -2 1]))
There is still a problem with multiple roots.
Walter Roberson
Walter Roberson le 21 Nov 2018
You are correct that roots does not do a good job on that . solve(poly2sym()) of the vector produces exact solutions though .

Connectez-vous pour commenter.

Plus de réponses (1)

Andrew Newell
Andrew Newell le 17 Nov 2011

0 votes

Unless this is an exercise, you could just use roots to solve your problem.

3 commentaires

Atta Oveisi
Atta Oveisi le 17 Nov 2011
what do you mean by "exercise"?
It's not an execise.this is part of a procedure that finds the natural frequencies of a circular cylinderical panel an a pasternak fundation.and if that real parts become zero the eigen functions of the system changes from bessel of first kind to the modified bessel function.and this change of the eigen functions leads to wrong natural frequencies.
thanks.
Andrew Newell
Andrew Newell le 17 Nov 2011
I'm just saying that if you don't have any compelling reason to write the m file yourself, you'd be better off using the MATLAB function.
Atta Oveisi
Atta Oveisi le 17 Nov 2011
I myself want to use "root" but the roblem is this function use it's own number of precision.my question is how to increase this.

Connectez-vous pour commenter.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by