1. Aug 7, 2011

mrlala

im new to matlab as well as this forum to. i dont know how to input rectangular function in matlab. i had search google, but it seems non of them are helpfull enough..
here is my function:
x=exp(t)*rect(t −1/2)
i have no idea to insert the part of 'rect'..
then, could anyone please explain to me what this function tells us..
cheers.

2. Aug 9, 2011

brydustin

First, you need to understand the definition of the function, I've never heard of this function but a simple copy-paste fo 'rect' into Google directed me to Wikipedia! Did you even try this?
http://en.wikipedia.org/wiki/Rectangular_function
Secondly, the function is shifted because the defintion is for rect(t)= rect(t-0) but you have rect(t-.5). So you need to add .5 to the conditional statements of the definition, obviously without changing the output of the function; this is equivalent to redefining T = t - .5 and applying the original rules.
Third, with a simple problem like this you need to draw the function's output before programming it; in this way, you know what to expect and if your code has any errors (or worse yet, you program it correctly but don't understand the function and therefore misdraw it).
Finally, program it; and don't post homework on this page anymore! This is a page for serious non-homework questions.