Here is my function:
$$3(t)(u(t)-1)) + (u(t-1)+3) - (u(t-3)+3) - 2(t)(u(t-3)+3) + u(t-4) -2(t)(u(t-6))$$
Is my function correct? If not, could you please tell me where I am wrong.
Thank you in advance.
Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. It only takes a minute to sign up.
Sign up to join this communityHere is my function:
$$3(t)(u(t)-1)) + (u(t-1)+3) - (u(t-3)+3) - 2(t)(u(t-3)+3) + u(t-4) -2(t)(u(t-6))$$
Is my function correct? If not, could you please tell me where I am wrong.
Thank you in advance.
If the diagram was given to you than your function is incorrect. First of all you don't need the small brackets for the time. If you look at the diagram you can see that you can disassemble it into smaller parts:
Part I: from 0 to 1 you have a curve which starts at (0,0) and ends at (1,3). If you plug in these $(x,y)$ values into the equation $y=kx+n$ you will get $n=0, k=3$ which means that the curve function is equal to $y=3x \Rightarrow f(t)=3t$. Since the interval is from 0 to 1 we get $u(t)-u(t-1)$ and multiplied by the curve function $3t[u(t)-u(t-1)]$.
Part II: from 1 to 3 you have a rectangular pulse with an amplitude of 3 which is $3[u(t-1)-u(t-3)]$.
Part III: from 3 to 4 you have again a curve whose function you retrieve the same way as in part I. You will get $(9-2t)[u(t-3)-u(t-4)]$.
Part IV: from 4 to 6 you have again a rectangular pulse but with an amplitude of 1 so you don't have to multiply the difference of the step functions because it's 1 by default. You will get this $u(t-4)-u(t-6)$.
Part V: Assuming that your signal equals to 0 for $t>7$ you again have a curve whose function you retrieve as in Part I and you get $(2t-11)[u(t-6)-u(t-7)]$.
Summing up all obtained parts your function would be:
$f(t)=3t[u(t)-u(t-1)]+3[u(t-1)-u(t-3)]+(9-2t)[u(t-3)-u(t-4)]+u(t-4)-u(t-6)+(2t-11)[u(t-6)-u(t-7)]$
If you use MATLAB here's the code and the plot:
t=0:0.01:8;
x = 3*t.*(stepfun(t,0)-stepfun(t,1))+3*(stepfun(t,1)-stepfun(t,3))+(9-2*t).*(stepfun(t,3)-stepfun(t,4))+stepfun(t,4)-stepfun(t,6)+(2*t-11).*(stepfun(t,6)-stepfun(t,7));
plot(t,x,'r');
axis([0 8 0 4])
grid on;