I need to plot a sine wave

조회 수: 224 (최근 30일)
Francis Arthur-Worsop
Francis Arthur-Worsop 2016년 11월 17일
답변: Aishwarya Gobade 2023년 1월 13일
I need to plot a sine wave with a frequency of 15 amplitude of 4 time of 0:0.1:1 how do i go about this, thanks :-)
  댓글 수: 3
Subhranil Barman
Subhranil Barman 2021년 1월 13일
Write a MATHLAB code to generate a CT step signal with peak Amplitude of 5 Volts and should be plotted on the time scale from 0 to 1000.
Rik
Rik 2021년 1월 13일
That comment sounds like a homework question. You can find guidelines for posting homework on this forum here. If you have trouble with Matlab basics you may consider doing the Onramp tutorial (which is provided for free by Mathworks). You may also consider re-reading the material you teacher provided and ask them for further clarification.

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

채택된 답변

Geoff Hayes
Geoff Hayes 2016년 11월 17일
Francis - from an example at fft, we can do
t = 0:0.01:1;
f = 15;
a = 4;
y = a*sin(2*pi*f*t);
plot(t,y);
Though ten samples (your t) may not be enough to accurately represent the sine wave (that you are attempting), so try
Fs = 1000;
t = linspace(0,1-1/Fs,Fs);
f = 15;
a = 4;
y = a*sin(2*pi*f*t);
plot(t,y);
  댓글 수: 1
Francis Arthur-Worsop
Francis Arthur-Worsop 2016년 11월 17일
thank you very much :-)

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

추가 답변 (4개)

Junyoung Ahn
Junyoung Ahn 2020년 6월 16일
clear;
clc;
close;
f=15; %frequency [Hz]
t=(0:1/(f*100):1);
a=4; %amplitude [V]
phi=0; %phase
y=a*sin(2*pi*f*t+phi);
plot(t,y)
xlabel('time(s)')
ylabel('amplitude(V)')

Jos (10584)
Jos (10584) 2016년 11월 17일
This is the general formula of a sine wave. If leave it to you to fill in the numbers.
y = Amplitude * sin(2*pi*f*t + phase)

cesar moreno
cesar moreno 2021년 2월 4일
If you need to load the generated data into an array of length N
then,
int k (the index of the array)
int N (the number of points in the data array)
The ARRAY holds values of type FLOAT example: array is called data[N] each location is a FLOAT
y = Amplitude * sin(2*pi*f*t + phase)
for k = 0 to N (load one location at a time)
data[k] = Amplitude * sin( ((2*pi*f*k)/N) + phase )

Aishwarya Gobade
Aishwarya Gobade 2023년 1월 13일
clear;
clc;
close;
f=15; %frequency [Hz]
t=(0:1/(f*100):1);
a=4; %amplitude [V]
phi=0; %phase
y=a*sin(2*pi*f*t+phi);
plot(t,y)
xlabel('time(s)')
ylabel('amplitude(V)')

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by