1. 正弦波方程 matlab n = 5000;%离散数据长度 f = 10;%正弦波频率 x = linspace(0,n/50/f,n);%每个周期50个数据点(代表精度) y = 1*sin(2*pi*f*x); plot(x,y) c++ int n = 5000;//离散数据长度 float f = 10;//正弦波频率 float y = 0; float step = n/50/f;//每个周期50个数据点(代表精度) for(float x = 0; x < n; x+=step) { y = 1*sin(2*pi*f*x);//输出(x,y) }