How could I do a summation of (y) so I can create a signal that goes from 0 to 30 sec repeating (y) every 3 seconds in a graph.
2 views (last 30 days)
Show older comments
A = 1.15;
t = linspace(-2, 1, 1000);
a = exp(-0.5*t);
y = A*a.*(sin(2*pi*3*t)) .* (ustep(t+2)-ustep(t));
figure
plot(t, y, 'LineWidth', 2)
xlabel('t');
ylabel('y');
title('L2E2');
grid on;
0 Comments
Accepted Answer
Paul
on 29 Mar 2022
Maybe this is the goal? Note that I modified the definition of y to make it in line with what I assumed the question means.
A = 1.15;
a = @(t) exp(-0.5*t);
ustep = @(t) t>=0;
y = @(t) A*a(t).*(sin(2*pi*3*t)) .* (ustep(t) - ustep(t-2)); % changed from original code
t = -3:.01:3;
figure;
plot(t,y(t))
t = 0:.01:30;
plot(t,y(mod(t,3)))
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!