Message Boards Message Boards

0
|
4819 Views
|
3 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Simple step plot

Posted 10 years ago

I want to plot a discontinuous step surface. I entered this plot statement:

Plot3D[{if[x > 0, x = 0, x = 1]}, {x, 2, -2}, {y, 2, -2}]

All I get is an empty box. What went wrong?

POSTED BY: Skip Cave
3 Replies
Posted 2 years ago

The Problem is nothing but, you have used small "i" instead of capital "I" for If function. Its working well.

POSTED BY: THEJUS V
Posted 10 years ago

Perfect! Thank you Nasser Abbasi!

POSTED BY: Skip Cave

Try with If and not if But may be better to use Piecewise

Clear[x, y]
f[x_] := Piecewise[{{0, x > 0}, {1, True}}];
Plot3D[f[x], {x, 2, -2}, {y, 2, -2}, Exclusions -> None]

enter image description here

POSTED BY: Nasser M. Abbasi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract