Is this how to correctly find the output signal using unit-amp and unit-step responses?

2 次查看(过去 30 天)
Hi, I'm quite new to Matlab and for an assignment I have to do the following;
1.Construct an anonymous function yu(t) for computing the unit-step response of the circuit. Construct an anonymous function yr(t) for computing the unit-ramp response of the circuit. Consider the system to be initially relaxed (zero initial conditions).
2. Express the output signal y(t) of the circuit given the input x(t), in terms of scaled and time shifted versions of the unit-step response and the unit-ramp response. Consider the system to be initially relaxed (zero initial conditions). Create an anonymous function for y(t). Compute it in the time interval (-2 <t <7) seconds with an increment of 0.01 seconds.
The input signal is:
The answer I have is:
And here is my code:
r = @(t) t.*(t>=0);
u = @(t) 1.*(t>=0);
x = @(t) (r(t).*(t<=1))-(2*u(t-1))+((r(2*(t-3))).*((t>=3)&(t<=4)))+((r(t-4)+2).*((t>4)&(t<5)))+(3*u(t-5));
x1 = x(t);
yu = @(t) (1-exp(-4*t)).*(t>=0);
yr = @(t) (t.*(1-exp(-4*t))).*(t>=0);
y = @(t) (yr(t).*(t<=1))-(2*yu(t-1))+((yr(2*(t-3))).*((t>=3)&(t<=4)))+((yr(t-4)+2).*((t>4)&(t<5)))+(3*yu(t-5));
y1 = y(t);
t = [-2:0.01:7];
figure(1);
plot(t,x1);
axis([-2 7 -2.5 2]);
title('Signal x(t)');
xlabel('time (sec)');
ylabel('Amplitude');
grid;
figure(2);
plot(t,x1,'b-',t,y1,'r--');
axis([-2 7 -2.5 2]);
title('Signals x(t) and y(t)');
xlabel('Time (sec)');
ylabel('Amplitude');
grid;
legend('Signal x(t)','Signal y(t)',...
'Location','SouthEast');
I have no idea if the answer I have got is anywhere close to the right answer so any advice/help would be great :)

回答(2 个)

vijaya lakshmi
vijaya lakshmi 2018-2-26
Hi Ellen,
I would suggest you that first convert the time domain signal into s-domain(Laplace transform) and then find out the unit step and unit ramp response of the signal.
Refer to this link for more information - Plotting System Response
step(sys)
impulse(sys)

mariam alazmii
mariam alazmii 2018-9-24
sketch by matlab consider the signal x1(t) shown in Figure 1.34(a) plot x1(t-1) , x1(-t+2),x1(t-1)+x1(-t+2),x1(t-1)-x1(-t+2), andx1(t-1)x1(-t+2)
please any one know how to solve it >>?

类别

Help CenterFile Exchange 中查找有关 Digital Filter Analysis 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by