Solving for coefficients in polynomial

I have the following equation in MATLAB which solves for my coefficients:
A45 = [(eta./eta_c).^(4:7).*(4:7)]\(Z_MD - Zfixed); % Solve for the higher order coefficients. This is the norm solution.
This represents the summation part of this equation:
I set the first 3 coefficients which is why it just goes from 4 to 7.
As you can see, since the equation is a sum over k*A_k*(eta./eta_c)^k. I believe the above equation solves for each A_k, correct? i think it does, but I'm not sure how it does it. The A_k's are not even in the MATLAB equation. How does it know to create these coeffs and solve for them?
Also, what if I wanted to have order 4-7 polynomial, but then I wanted to skip 8 and 9 and do 10? How would I do that?
The following does not work:
A45 = [(eta./eta_c).^(4:7,10).*(4:7,10)]\(Z_MD - Zfixed); % Solve for the higher order coefficients. This is the norm solution.

Respuestas (2)

Matt J
Matt J el 4 de Abr. de 2019
Editada: Matt J el 4 de Abr. de 2019
How does it know to create these coeffs and solve for them?
In Matlab, if you have a matrix equation M*x=z, you can solve for x by doing
x=M\z;
In the special case where M is a square non-singular matrix, this is similar to doing x=inv(M)*z, but better. This is all that the code you've posted is doing, for a particular choice of the matrix M and z.
How does it know how many x(i) to solve for? From the number of columns of the matrix M.

2 comentarios

Ok cool, so just to be clear. If I have:
A45 = [(eta./eta_c).^([4:7,10,22]).*([4:7,10,22])]\(Z_MD - Zfixed);
Then this would sove for A4, A5, A6, A7,A10, and A22 correct? I am just ignoring the other terms (A8, A9, A11-A21).
Matt J
Matt J el 4 de Abr. de 2019
if you are assuming that A8, A9, A11-A21 are all zero, then yes, what you say is correct.

Iniciar sesión para comentar.

Walter Roberson
Walter Roberson el 3 de Abr. de 2019
k = 4:7;
A45 = [k .* A(k) .* (eta./eta_c).^k]\(Z_MD - Zfixed); % Solve for the higher order coefficients. This is the norm solution.
and you could also use k = [4:7, 10]

5 comentarios

Matt J
Matt J el 3 de Abr. de 2019
and you must also make sure that Zfixed contains the contributions of k=[8,9].
Benjamin Cowen
Benjamin Cowen el 3 de Abr. de 2019
Walter, is something wrong with the way it was? It was from a solution on another answer. Was the A(k) accidentally left out or was that method actually still solving for Ak? It seems like it was still solving for it since it produced a vector the length that I had.
Matt J
Matt J el 3 de Abr. de 2019
Editada: Matt J el 3 de Abr. de 2019
I think Walter really meant to write,
Ak = [k .* (eta./eta_c).^k]\(Z_MD - Zfixed);
Walter Roberson
Walter Roberson el 4 de Abr. de 2019
No. I have no idea why that \ is being done; the original equation has no obvious polynomial. But the original equation does have a sum of A_k times those factors, so A(k) should appear in the list.
Benjamin Cowen
Benjamin Cowen el 4 de Abr. de 2019
It is a polynomial. Eta is the variable being squared, cubed, etc. I’m only caring about the summation term not the others, so it is a polynomial. Eta_c is a constant

Iniciar sesión para comentar.

Preguntada:

el 3 de Abr. de 2019

Comentada:

el 4 de Abr. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by