- #1
Lolsauce
- 23
- 0
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.
Given this waveform use the step function to find an equation:
http://img163.imageshack.us/img163/2545/stepfunction.jpg"
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.
Given this waveform use the step function to find an equation:
http://img163.imageshack.us/img163/2545/stepfunction.jpg"
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.
Code:
>> 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]
Any tips or suggestions would be helpful, thank you.
Last edited by a moderator: