MATLAB-finding roots and summations

  • Thread starter Dsab123
  • Start date
  • Tags
    Roots
In summary, the conversation discusses using MATLAB to find the roots of a given polynomial and using those roots to define a complex valued function. The speaker is struggling with computing a sum in MATLAB and understanding the concept of complex constants. They mention being able to figure out the remaining problems.
  • #1
Dsab123
2
0

Homework Statement



(all this is included in the attachment, btw)

p(z)=z^4+4.25*z^2+1

1. use MATLAB to find the four roots Ck of
p(z)= 0

2. For all complex constants ck (different than Ck) define the complex valued function
Z(t)= 4[tex]\Sigma[/tex]k=1 ck*exp(Ck*t)

^^that is a sigma sign with variable k going from one to four


Homework Equations



p(z)=z^4+4.25*z^2+1
a=4.25

The Attempt at a Solution



Number 1 I can do fine, my code is as follows:

>> syms x
>> y=(x^4+4.25*x^2+1)
>> >> solve (y)
ans =
(-2)*i
2*i
-i/2
i/2

The problem is when I get to problem 2, because I have just about no idea of how to compute a sum in matlab. I've tried a for loop with k going from one to for, after naming each of the roots C1, C2, C3, C4.

Also, I'm having some trouble figuring out what it means by 'complex constants ck'..
sorry I'm not much help in understanding this haha.


3 and 4 i think I can figure out
Any help would be very much appreciated
 

Attachments

  • 246-10-MAT1.pdf
    42.7 KB · Views: 267
Physics news on Phys.org
  • #2
I don't do much with symbolic in Matlab, but something like this should work.

>> syms x
>> y=(x^4+4.25*x^2+1)
>> roots = solve (y)
Z=0;
syms t
for j=1:length(roots)
Z = Z + roots(j)*exp(roots(j)*t)
end
 

Related to MATLAB-finding roots and summations

1. How do I find the roots of an equation in MATLAB?

In MATLAB, you can use the roots function to find the roots of a given polynomial equation. The syntax is roots(p), where p is a vector containing the coefficients of the polynomial in descending order. The function will return a column vector with the roots of the equation.

2. Can I find complex roots using MATLAB?

Yes, the roots function in MATLAB can find both real and complex roots of a polynomial equation. If the equation has complex roots, the function will return them as a complex column vector with the real parts in the first column and the imaginary parts in the second column.

3. How can I find the summation of a series in MATLAB?

To find the summation of a series in MATLAB, you can use the sum function. The syntax is sum(x), where x is a vector containing the elements of the series. If you want to find the summation of a specific portion of the series, you can use the syntax sum(x, k) where k is the upper limit of the sum.

4. Can I use MATLAB to find the roots of a function graphically?

Yes, you can use the fzero function in MATLAB to find the roots of a function graphically. This function requires an initial guess for the root and will return the most accurate root it can find. The syntax is fzero(fun,x0), where fun is the function and x0 is the initial guess.

5. Is there a way to improve the accuracy of root finding in MATLAB?

Yes, you can improve the accuracy of root finding in MATLAB by using the fzero function with the optional options argument. This allows you to specify the desired tolerance for the root and the maximum number of iterations. You can also use the optimset function to customize the options for fzero.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
958
  • Engineering and Comp Sci Homework Help
Replies
6
Views
936
  • Engineering and Comp Sci Homework Help
Replies
1
Views
830
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
Back
Top