Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我可以在我的 iPhone 应用程序中使用 Core Plot 创建波形,但它不像 Sine Wave。 这是您可以看到如何生成波的链接,但我想以正弦波形式显示这些波。我应该遵循哪种算法?请建议!
(因为我只有 1 个声望,所以我不能添加照片,所以分享了一个链接)
您将需要获得正确的 x 和 y 坐标。想想,那应该给你正弦波。
如果我们尝试实现简单的正弦公式 -
y(t) = A*sin(w*t + 相位)
float y; for(float x=rect.origin.x; x < rect.size.width; x++) { y = ((rect.size.height/4) * sin(0.3 * x + 0)); NSLog(@"x = %f \t y = %f \n",x,y); }
尝试使用这些值,并告诉我它是如何产生的。