Create An Array That Contains All the Values of F(x)? Help!
Mostrar comentarios más antiguos
I have a function f(x) that equals x if x < 1 and x^2 elsewhere.
How would I go about putting all the values of f(x) into another array, named y, for example?
1 comentario
Steven
el 19 de Sept. de 2013
Respuesta aceptada
Más respuestas (2)
James Tursa
el 19 de Sept. de 2013
0 votos
y = x;
y(y<1) = 1;
y = y.*x;
Azzi Abdelmalek
el 19 de Sept. de 2013
x=-5:5
y=(x<1).*x+(x>=1).*x.^2
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!