How to create a specific vector c that has two variables x and y ?
Mostrar comentarios más antiguos
the problem here is this vector must be found from c = A\b. A and b are created from two variables x and y. (I posted the image of example xi,yi). x and y come from the normal parabola(ax^2 + bx +c) first, then they could be used in the matrix to form A and b. if my question is too confusing, just see the image...sorry, I am not good at explaining a problem :c Is there a way to solve it ? Thank you.

3 comentarios
Roger Stafford
el 28 de Feb. de 2018
Editada: Roger Stafford
el 28 de Feb. de 2018
Your question is puzzling. You seem to have solved your own question by writing the equation c = A\b. That is a valid matlab operation and is presumably the answer you are seeking. You have three linear equations in three unknowns, a, b, and c, and your matlab expression is how you solve such a problem in matlab. The only difficulty that might occur is if the matrix A of coefficients happened to be singular, that is, its determinant were equal to zero, in which case there might either be no solution or perhaps many solutions.
CodeElinesa
el 28 de Feb. de 2018
CodeElinesa
el 28 de Feb. de 2018
Editada: CodeElinesa
el 28 de Feb. de 2018
Respuestas (1)
Roger Stafford
el 28 de Feb. de 2018
Editada: Stephen23
el 28 de Feb. de 2018
Assume your xi's and yi's are given by a couple of column vectors, x and y of the same length.
n = length(x);
A = [x.^(n-1:-1:0)];
c = A\y;
2 comentarios
CodeElinesa
el 28 de Feb. de 2018
Roger Stafford
el 28 de Feb. de 2018
If you have an older version of matlab, use
A = bsxfun(@power,x,((n-1):-1:0));
where again I assume x is a column vector.
Categorías
Más información sobre Image Arithmetic en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!