Finding varible in equation from vectors.

1 visualización (últimos 30 días)
Giuseppe
Giuseppe el 26 de Mzo. de 2014
Respondida: Mischa Kim el 26 de Mzo. de 2014
I have
x = [1 2 3]
y = [1 2 1]
m = [1 -1 0]
For the equation y = mx +c (linear expression) I want to find c (y intercept) for each. i.e here
1=1*1 + c (equation 1)
2=-1*2 + c (equation 2)
1=0*3 + c (equation 3)
How would I write this as a vectorized code where the values for c are stored in a matrix. Note I want to find c for each equation not for all. I can't use built in functions. I think I have to use ==? It must hold true if there was more equations or there values were changed.
Thanks,

Respuesta aceptada

Mischa Kim
Mischa Kim el 26 de Mzo. de 2014
Giuseppe, use
c = y - m.*x

Más respuestas (0)

Categorías

Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by