Representing Unit Step Function in MATLAB

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 reply · 10K views
DefaultName
Messages
179
Reaction score
0
How do you represent a unit step in MATLAB as ONE function, y , for example. I know only how to graph multiple vectors on top of the same graph (using hold on/off) and getting the graph output, but i can't represent it as a function itself.

Any ideas?
 
Physics news on Phys.org
DefaultName said:
How do you represent a unit step in MATLAB as ONE function, y , for example. I know only how to graph multiple vectors on top of the same graph (using hold on/off) and getting the graph output, but i can't represent it as a function itself.

Any ideas?

If I understood your question correctly, you can do

y = (t>=0)

*Note : You have to predefine the vector t.

for the unit step function y = u(t)

Or use heaviside function.