I am trying to write a program to solve for the roots (x) of a 4th order polynomial of the form:
ax^4 + bx^3 + cx^2 + dx + e = 0
However, the coefficients of the above polynomial change over time with n time steps. Each coefficient has it's own equation based on other variables that change in time. So what I've been trying to do is write a 3 dimensional array that is 1 row, 5 columns representing each coefficient and n time steps:
P( 1, 5, n )
Then I was trying to take the root of all the elements in that row for any given time step. But I'm not sure how to create a new array that includes the roots of the polynomial solutions to each time step n. The roots function creates a matrix that is 4 rows by 1 column (only 2 dimensional). nts is the last time step.
For n = 1:ntsSome array ( 4, 1, n ) = roots ( P(1, 5, n )
Once I have this new array, I need to be able to call on the 3rd root in the matrix or Some array ( 3, 1, n ).
I'm not too familiar with Matlab but it's the only way I can solve these roots as Excel Solver is not working.
Best Answer