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

 採用された回答

Matt Fig
Matt Fig 2011 年 3 月 22 日

0 投票

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 件のコメント

Lynn Ting
Lynn Ting 2011 年 3 月 22 日
I want to convert my sin graph into discrete data.
Matt Fig
Matt Fig 2011 年 3 月 22 日
xd = get(get(gca,'child'),'xdata');
yd = get(get(gca,'child'),'ydata');
Matt Fig
Matt Fig 2011 年 3 月 22 日
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 2011 年 3 月 22 日
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 2011 年 3 月 22 日
That is a different question than the one you asked before. But see above.
Lynn Ting
Lynn Ting 2011 年 3 月 22 日
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?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by