Finding Roots of an Equation in MATLAB

  • Context: MATLAB 
  • Thread starter Thread starter adnan jahan
  • Start date Start date
  • Tags Tags
    Matlab Roots
Click For Summary

Discussion Overview

The discussion revolves around finding the roots of the polynomial equation x^8 - 2x^6 + 3x^4 - 7x^2 + a = 0 using MATLAB. Participants explore different methods to obtain four non-repeating roots and also touch upon related plotting techniques in MATLAB.

Discussion Character

  • Technical explanation
  • Homework-related

Main Points Raised

  • One participant presents a method using the MATLAB function roots to find the roots of the polynomial defined by the coefficients p=[1 -2 3 -7 1].
  • Another participant suggests that the polynomial can be treated as a function of x^2, implying that the roots should include both the positive and negative square roots.
  • A participant requests assistance on how to define the vertical axis in MATLAB plots, indicating a need for clarification on plotting techniques.
  • Another participant reiterates the request for help with defining the vertical axis in MATLAB, leading to a response that provides specific commands for setting axis properties.

Areas of Agreement / Disagreement

There is some agreement on the method for finding roots, with one participant affirming the approach suggested by another. However, the discussion does not reach a consensus on the best method to ensure four non-repeating roots, as the initial query remains unresolved.

Contextual Notes

The discussion does not clarify the value of a in the polynomial, which may affect the roots. Additionally, the implications of using the positive and negative roots are not fully explored.

Who May Find This Useful

This discussion may be useful for individuals interested in numerical methods for solving polynomial equations in MATLAB, as well as those seeking guidance on MATLAB plotting techniques.

adnan jahan
Messages
93
Reaction score
0
Dear Fellow,

I need to find the roots of equation
x^8- 2x^6+3x^4-7x^2+a=0
in MATLAB, in such a way that I need 4 non repeating roots.

I have used the technique of
p=[1 -2 3 -7 1]
s=roots(p)
x1=s(1)
x2=s(2)
x3=s(3)
x4=s(4)
where xi,i=1,2,3,4 are roots of the above equation,

2nd option my friend gave me is

p=[1 -2 3 -7 1]
s=sqrt(roots(p))
x1=s(1)
x2=s(2)
x3=s(3)
x4=s(4)
this will again give me four roots of the equation,

need your help to find the four roots of above equation.


Regards
 
Physics news on Phys.org
Clearly your polynomial is in x^2, so your friends solution is the correct one. Though you should of course use the plus and minus (+/-) of the roots.
 
Okay ,,,, thanks uart,, that's really help full
 
can you please give my any idea how to define vertical axis in MATLAB plot command

thanks
 
adnan jahan said:
can you please give my any idea how to define vertical axis in MATLAB plot command

thanks

it's automatically designated by your data set, but you can also set particular properties of the axis with (for example):

set(gca,'YTick',[0 0.05 0.075 0.1 0.15 0.2 0.25])

and you could even go as far as to label each of the points:

set(gca,'YTickLabel','0|0.05|Cutoff|0.1|0.15|0.2|0.25')

full documentation:
http://www.mathworks.com/help/techdoc/creating_plots/f1-19798.html
 
Last edited by a moderator:

Similar threads

  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 3 ·
Replies
3
Views
5K