# Plotting a piecewise function [closed]

I'm having trouble plotting the piecewise function below. The only way I can replicate this function is using

Plot[Piecewise[{{x^2, x >= 0}, {0, x < 0}}], {x, -10, 10}]

When I define the piecewise function as:

unitstep[x] = Piecewise[{{x^2, x >= 0}, {0, x < 0}}]


and then plot unitstep[x], the graph turns out linear.

Am I missing something here?

## closed as off-topic by Bob Hanlon, march, MarcoB, m_goldberg, happy fishFeb 18 '17 at 4:30

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Bob Hanlon, march, MarcoB, m_goldberg, happy fish
If this question can be reworded to fit the rules in the help center, please edit the question.

• Your second function is not proper Mathematica code. Can you post the commands exactly as you have them in your notebook? – Felix Feb 17 '17 at 23:23

If you define unitstep (not a good name) as follows
unitstep[x_] := Piecewise[{{x^2, x >= 0}, {0, x < 0}}]