Continuous-Time Signal Plotting
33 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Need help plotting the problem.
Let y(t)= r(t+2)-r(t+1)+r(t)-r(t-1)-u(t-1)-r(t-2)+r(t-3), where r(t) is the ramp function.
a) plot y(t)
b) plot y’(t)
c) Plot y(2t-3)
note: r(t)=t for t≥0 and 0 for t<0
0 comentarios
Respuestas (1)
Kautuk Raj
el 3 de Jun. de 2023
The following MATLAB code will plot the three functions pointed by you:
% Define the ramp function r(t)
r = @(t) t.*(t >= 0);
% Define the function y(t) and its derivative y'(t)
y = @(t) r(t+2)-r(t+1)+r(t)-r(t-1)-r(t-2)+r(t-3)-r(t-1);
y_prime = @(t) r(t+2)-2*r(t+1)+2*r(t)-2*r(t-1)+r(t-2);
% Define the time range for the plots
t = -5:0.1:5;
% Evaluate the functions over the time range
y_values = arrayfun(y, t);
y_prime_values = arrayfun(y_prime, t);
y_2t_3_values = arrayfun(@(t) y(2*t-3), t);
% Plot the functions
subplot(3, 1, 1);
plot(t, y_values);
xlabel('t');
ylabel('y(t)');
title('Plot of y(t)');
subplot(3, 1, 2);
plot(t, y_prime_values);
xlabel('t');
ylabel('y''(t)');
title('Plot of y''(t)');
subplot(3, 1, 3);
plot(t, y_2t_3_values);
xlabel('t');
ylabel('y(2t-3)');
title('Plot of y(2t-3)');
The resultant plots look like this:
0 comentarios
Ver también
Categorías
Más información sobre Line Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!