creating a piecewise graph

For an assignment, I need to create a piecewise graph using the Heaviside function, but I have an equation 15 + 2*(x-1), x>=2, for a data set of 0:0.1:5. I am not sure how to input it using the Heaviside function.

 Risposta accettata

@Noah, you can probably test out the code, if this is the desired output:
x = 0:1e-5:5;
y = (15 + 2*(x - 1)).*heaviside(x - 2);
plot(x, y), grid on, ylim([-5 25]), xlabel('x')

Più risposte (0)

Categorie

Scopri di più su Networks in Centro assistenza e File Exchange

Prodotti

Release

R2022a

Tag

Richiesto:

il 13 Set 2022

Risposto:

il 13 Set 2022

Community Treasure Hunt

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

Start Hunting!

Translated by