Cos Magnitude changing for unknown reasons

2 次查看(过去 30 天)
This is probably not mat labs fault but i don't understand why my magnitude is changing
If i plot
.5*cos(x)
no surprise my min and max magnitude of the function is -.5 and plus .5
if i plot
.5*cos(2*pi*60*x)
My min max magnitude is changing from -.4 to .5 Why am i loosing .1 on the bottom just by changing the frequency

回答(1 个)

Star Strider
Star Strider 2016-9-28
I don’t know what ‘x’ is, but what you are probably seeing is the phenomenon known as ‘aliasing’, where your sampling frequency is lower than the frequency of your cosine function.
  2 个评论
Robert
Robert 2016-9-28
编辑:Robert 2016-9-28
X can be anything
Call it 0 to 2*pi if you want I have had the problem on any interval
Im not sampling anything although i know what ur talking about from DSP
This is just sampling referring to any old plot of cos(x)
You can even do this in wolfram
Plot .5cos(x) and i get -.5 and .5 then plot .5cos(2*pi*60*x) and all of a sudden my plot is -.4 to .5 No clue why
Star Strider
Star Strider 2016-9-28
Not the interval, the sampling frequency.
Example:
x = linspace(0, 1, 1200);
y = .5*cos(2*pi*60*x);
min_max = [min(y), max(y)]
figure(1)
plot(x, y)
grid
min_max =
-0.499998283668634 0.5
This is about as close as you can reasonably get. The inaccuracies are likely those inherent to any floating-point calculations.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by