I need to plot a sine wave
Mostrar comentarios más antiguos
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 comentarios
Jan
el 17 de Nov. de 2016
Please use meaningful tags only.
Subhranil Barman
el 13 de En. de 2021
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
el 13 de En. de 2021
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.
Respuesta aceptada
Más respuestas (4)
Junyoung Ahn
el 16 de Jun. de 2020
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)')
1 comentario
Sinan Islam
el 25 de Nov. de 2020
Good job!
Jos (10584)
el 17 de Nov. de 2016
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
el 4 de Feb. de 2021
0 votos
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
el 13 de En. de 2023
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)')
Categorías
Más información sobre Programming en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!