MATLAB: How to fill a 1024 point array with two cycles of a cosine wave

array

How to fill a 1024 point array with two cycles of a cosine wave?

Best Answer

You can use linspace.
Example:
xData = linspace(0,4*pi,1024);
yData = cos(xData);
figure;
plot(xData,yData);