How to change number of cycles by changing frequency to plot sine wave?

1 次查看(过去 30 天)
x=sin(2*Pi*f*t)

回答(1 个)

檮杌
檮杌 2023-10-1
t = linspace(0, 1, 100);
f1 = 1; % Hz
f2 = 2; % Hz
x1 = sin(2*pi*f1*t);
x2 = sin(2*pi*f2*t);
plot(t, x1);
hold on;
plot(t, x2);
xlabel("time(s)");
ylabel("Amplitude");
legend("1 Hz", "2 Hz")

类别

Help CenterFile Exchange 中查找有关 Legend 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by