Problem with writing this function
Mostrar comentarios más antiguos
I do not understand what is wrong with this function. When I try to run the function written like this the error down below comes up.
y = (x.-1)/((x.^2).+x)

Respuesta aceptada
Más respuestas (1)
Vikas Kumar
el 9 de Oct. de 2019
0 votos
Agree with Jon. I think you are getting error because of . operator you use with the addition and subtraction. This . operator is only meaningful when you want to do element by element operation, which in case of addition and subtraction is by default.
So:
y = (x-1)./((x.^2)+x)
1 comentario
Jon
el 9 de Oct. de 2019
Note also that parenthesis around exponentiation are not necessary either. They do not cause an error, but make the expression harder to read.
Categorías
Más información sobre Creating and Concatenating Matrices 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!