plot 8 cycles sin graph, convert to discrete and measure?

Hie guys, can i know how to plot a sin graph with a amplitude 22000 which have 8 cycles inside from range 0 to 1024. I try to plot, but it goes from small to big.
If is possible to convert the sin graph to discrete function and measure the point?How to implement it?
THANKS
Lynn

 Respuesta aceptada

Matt Fig
Matt Fig el 22 de Mzo. de 2011
I don't know what you mean by "convert the graph to a discrete function." Do you mean you want to get a point from the graph? If so, then look at the GINPUT function. If not, then please explain better.
.
.
.
.
EDIT The new question, as it evolves...
t = 1:.1:1024;
f = @(x) 22000*sin(x);
plot(t,f(t))
pause(.5)
% Notice that this is more than 8 cycles, so let's zoom in:
xlim([t(1) 16*pi+t(1)])

6 comentarios

Lynn Ting
Lynn Ting el 22 de Mzo. de 2011
I want to convert my sin graph into discrete data.
Matt Fig
Matt Fig el 22 de Mzo. de 2011
xd = get(get(gca,'child'),'xdata');
yd = get(get(gca,'child'),'ydata');
Matt Fig
Matt Fig el 22 de Mzo. de 2011
Note that the above assumes there is only one plot on the axes. If there is more than one plot, you should look at the children of the axes and determine which line is the one you want, then get its xdata and ydata. Alternatively, why not just use the data which was used to make the plot??
Lynn Ting
Lynn Ting el 22 de Mzo. de 2011
Do u mind teaching me, how to plot 8 cycles of sin wave from t = 1 to 1024? I could not specificly have the x-axis correct.
Matt Fig
Matt Fig el 22 de Mzo. de 2011
That is a different question than the one you asked before. But see above.
Lynn Ting
Lynn Ting el 22 de Mzo. de 2011
Thanks for the code Matt
Matt can i know what is @x?and what is the parameters xlim?
Is it possible to change the frequency for the sin graph?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 22 de Mzo. de 2011

Community Treasure Hunt

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

Start Hunting!

Translated by