Continuous-Time Signal Plotting

9 Ansichten (letzte 30 Tage)
Romaine Pryce
Romaine Pryce am 28 Mai 2021
Beantwortet: Kautuk Raj am 3 Jun. 2023
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

Antworten (1)

Kautuk Raj
Kautuk Raj am 3 Jun. 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:

Kategorien

Mehr zu Line Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by