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 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Roberto Santana
am 28 Mär. 2022
Beantwortet: Paul
am 29 Mär. 2022
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 Kommentare
Akzeptierte Antwort
Paul
am 29 Mär. 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 Kommentare
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!