how can i define a piecewise function in matlab
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
how i define a function like this h=0 when x-w/2<=d<=x+w/2 h=1 otherwise
0 comentarios
Respuestas (1)
Sean de Wolski
el 12 de Oct. de 2012
Use logical indexing, for this case, you don't even need to apply the logical indices:
h = ~(x-w/2 <= d & d <= x+w/2);
0 comentarios
Ver también
Categorías
Más información sobre Elementary Math en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!