Representing Unit Step Function in MATLAB

Click For Summary
To represent a unit step function in MATLAB, you can define it as y = (t >= 0), where t is a predefined vector. Alternatively, the Heaviside function can be used for the same purpose. Both methods allow for the representation of the unit step function as a single function rather than multiple vectors. This approach simplifies the graphing process by encapsulating the unit step behavior in one expression. Utilizing these methods will enhance your MATLAB function representation capabilities.
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.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K