how can i plot this piceise function?
Mostrar comentarios más antiguos
>> x = 0 : 0.01 : 25;
for k = 1 : length(x)
if x < 6.7
y(k) = 1200*x;
elseif x >= 6.7 && x < 12
y(k) = 83*x;
else
y(k) = -1200*x;
end
end
plot(x, y);
grid on;
Respuestas (1)
Torsten
el 1 de Dic. de 2017
x = 0 : 0.01 : 25;
for k = 1 : length(x)
if x(k) < 6.7
y(k) = 1200*x(k);
elseif x(k) >= 6.7 && x(k) < 12
y(k) = 83*x(k);
else
y(k) = -1200*x(k);
end
end
plot(x, y);
grid on;
Best wishes
Torsten.
1 comentario
Jesper Christensen
el 1 de Dic. de 2017
Categorías
Más información sobre Mathematics 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!