Plot a sine wave with the following... how to plot it?

조회 수: 9 (최근 30일)
Jayanta Deb
Jayanta Deb . 2017년 6월 7일
답변: SWETA K . 2021년 2월 19일
Create a time vector, sine wave, 5 periods, 1 kHz, amplitude 2 volts in 5 x 1024 samples (time axis) as well as 5 periods in 4096 samples
  댓글 수: 2
Jayanta Deb
Jayanta Deb 2017년 6월 7일
t=[0:1:1024]; A= 2; f=1000; fs=5;
x=sin(2*pi*f/fs*t);
plot(t,x)
I am new so, I am not sure if it is correct with the context of the question?

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

채택된 답변

Rik
Rik 2017년 6월 7일
You're very close:
freq=1000;%1 kHz
t=linspace(0,5,1024)/freq;%from 0 to 5 periods in 1024 steps
A=2;%amplitude
x=A*sin(freq*t*2*pi);
plot(t,x)
I don't really see how more samples will change things, but you can just change the linspace parameters.
BTW, for next time: have a read here and here. It will greatly improve your chances of getting an answer.

추가 답변 (1개)

SWETA K
SWETA K 2021년 2월 19일
x=0:3.14/100:2*3.14;
y=sin(x);
plot(x,y);
title('A Plot of Sine Curve');xlabel ('x-axis');
ylabel ('y-axis');

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by