wiz0r
- 56
- 0
Ok, so what I need to do is;
Given the functions;
x1(t)= tu(t)-tu(t-1) and x2(t)=10e^-4tu(t), do the following:
1. Plot x1(t) and x2(t) using MATLAB.
2. Use MATLAB to find and plot x(t)=x1(t)* x2(t), where * denotes convolution.
3. Find x(t)=x1(t)* x2(t) by hand using Laplace transforms.
4. Plot the result of part 3 in MATLAB and compare it to that found in part 2.
Okay, what I had trouble was defing u(t). Since, according to my book it says that u(t) = 0 if t<0, and u(t) = 1 if t>0. Also that; u(t-1) = 1 if 1<t<infinite, and u(t-1) = 0 if t<1. So,
what I tried to do was to define the two functions, one would be u(t) and the other u(t-1). So, I had two functions(m.files) named, u, and v. v being u(t-1). So, I would use them on my original program. the two function would look like;
u(t) =
v(t) = u(t-1)
my original program would look like;
I really thought that would work, but bleh, it doesn't. Can anyone help me telling me what's wrong?
PS: I have no experience programming with MATLAB. I only know very basic C. So, yeah, please bare with me.
Edwin
Given the functions;
x1(t)= tu(t)-tu(t-1) and x2(t)=10e^-4tu(t), do the following:
1. Plot x1(t) and x2(t) using MATLAB.
2. Use MATLAB to find and plot x(t)=x1(t)* x2(t), where * denotes convolution.
3. Find x(t)=x1(t)* x2(t) by hand using Laplace transforms.
4. Plot the result of part 3 in MATLAB and compare it to that found in part 2.
Okay, what I had trouble was defing u(t). Since, according to my book it says that u(t) = 0 if t<0, and u(t) = 1 if t>0. Also that; u(t-1) = 1 if 1<t<infinite, and u(t-1) = 0 if t<1. So,
what I tried to do was to define the two functions, one would be u(t) and the other u(t-1). So, I had two functions(m.files) named, u, and v. v being u(t-1). So, I would use them on my original program. the two function would look like;
u(t) =
Code:
function u = u(t)
if t > 0
u = 1;
else
u = 0;
end
v(t) = u(t-1)
Code:
function v = v(t)
if t > 1
v = 1;
else
v = 0;
end
my original program would look like;
Code:
t = 0:0.1:10;
x1 = t*u - t*v;
x2 = 10*exp(-4*t)*u;
plot(t,x1)
plot(t,x2)
y = conv(x1,x2);
plot(t,y)
return;
I really thought that would work, but bleh, it doesn't. Can anyone help me telling me what's wrong?
PS: I have no experience programming with MATLAB. I only know very basic C. So, yeah, please bare with me.
Edwin