Continuous-Time Signal Plotting

23 ビュー (過去 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 Center および File ExchangePulse and Transition Metrics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by