So I'm not going to lie, I'm pretty new with this software. I was assign a homework assignment, but I'm not sure how you graph a step function.(adsbygoogle = window.adsbygoogle || []).push({});

Given this waveform use the step function to find an equation:

http://img163.imageshack.us/img163/2545/stepfunction.jpg" [Broken]

I calculated the step function to be:

x(t) = (t^2)[u(t)-u(t-2)]+2(t-4)[u(t-2)-u(t-4)] , which I'm pretty positive is right.

Now graphing in Matlab is my biggest problem. I've looked over my textbook at sample graphing techniques, this is what I have attempted.

Any tips or suggestions would be helpful, thank you.Code (Text):>> x = inline('(t^2)(u(t)-u(t-2))+2(t-4)(u(t-2)-u(t-4))', 't')

g =

Inline function:

g(t) = (t^2)(u(t)-u(t-2))+2(t-4)(u(t-2)-u(t-4))

>> t = (-1:5);

>> plot(t,g(t));

[COLOR="Red"]??? Error using ==> inlineeval at 15

Error in inline expression ==>

(t^2)(u(t)-u(t-2))+2(t-4)(u(t-2)-u(t-4))

Error: Unbalanced or unexpected

parenthesis or bracket.

Error in ==> inline.subsref at 27

INLINE_OUT_ =

inlineeval(INLINE_INPUTS_,

INLINE_OBJ_.inputExpr,

INLINE_OBJ_.expr);[/COLOR]

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Need help graphing a step function within Matlab

**Physics Forums | Science Articles, Homework Help, Discussion**