Continuous-Time Signal Plotting

조회 수: 24 (최근 30일)
Romaine Pryce
Romaine Pryce 2021년 5월 28일
답변: Kautuk Raj 2023년 6월 3일
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

답변 (1개)

Kautuk Raj
Kautuk Raj 2023년 6월 3일
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:

카테고리

Help CenterFile Exchange에서 Pulse and Transition Metrics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by