how to generate a sin function of time ....

조회 수: 37 (최근 30일)
aa
aa 2020년 9월 14일
댓글: Image Analyst 2020년 9월 14일
how to generate a sine function of time with 1024 second long ... and generate 8 full cycle over this interval ....

채택된 답변

Image Analyst
Image Analyst 2020년 9월 14일
편집: Image Analyst 2020년 9월 14일
How many samples do you want over that 1024 seconds? Let's say it's 50,000:
numSamples = 50000;
t = linspace(0, 1024, numSamples);
period = numSamples / 8; % Want 8 full cycles
amplitude = 1; % Whatever.
y = amplitude * sin(2 * pi * t / period);
plot(t, y, 'b-', 'LineWidth', 2);
grid on;
xlabel('t', 'FontSize', 20);
ylabel('y', 'FontSize', 20);
  댓글 수: 2
aa
aa 2020년 9월 14일
I need 1024 sample only ... I just try to run tghis code but it gives error
Image Analyst
Image Analyst 2020년 9월 14일
numSamples = 1024;
t = linspace(0, 1024, numSamples);
period = numSamples / 8; % Want 8 full cycles
amplitude = 1; % Whatever.
y = amplitude * sin(2 * pi * t / period);
plot(t, y, 'b-', 'LineWidth', 2);
grid on;
xlabel('t', 'FontSize', 20);
ylabel('y', 'FontSize', 20);

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Switches and Breakers에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by