Generating a 6 second sine wave?

조회 수: 30 (최근 30일)
Dick Rusell
Dick Rusell 2014년 10월 7일
댓글: Akpabio Ekpewoh 2019년 7월 11일
I'm supposed to generate a 6 seconds long sine wave that has amplitude of 1.0, frequency of 400Hz at a 8KHz sampling frequency, but I'm not sure how to control how long the wave lasts for.

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 10월 7일
f=400
Amp=1
ts=1/8000;
T=6
t=0:ts:T;
y=sin(2*pi*f*t);
plot(t,y)
  댓글 수: 3
Image Analyst
Image Analyst 2018년 3월 26일
Add a function line:
function [t, y] = PlaySound()
f=100;
Amp=10;
fs = 44100;
ts=1/44100;
T=10;
t=0:ts:T;
y=sin(2*pi*f*t);
sound(y,fs)
Mohamad
Mohamad 2019년 4월 4일
f=400
Amp=1
ts=1/8000;
T=6
t=0:ts:T-ts; % I modified this line to make signal duration 6 seconds
y=sin(2*pi*f*t);
plot(t,y)

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

추가 답변 (1개)

Image Analyst
Image Analyst 2014년 10월 7일
Hint: 6 seconds at 8000 times per second means that the vector (row array) will be 48000 elements long.
sineWave = sin(2*pi*freq*timeVector);
See if that's enough hints.
  댓글 수: 3
Dick Rusell
Dick Rusell 2014년 10월 10일
Is there a way to zoom outt? Because I get a blue box when I plot it from the frequency.
Akpabio Ekpewoh
Akpabio Ekpewoh 2019년 7월 11일
Yes, just use the icons on the top of the plot

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

카테고리

Help CenterFile Exchange에서 Waveform Generation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by