Sampling Cosine MATLAB

steveb

Joined Jul 3, 2008
2,436
I need to take 27 uniformly distributed samples from a cosine fuction over the interval (-pi/2, pi/2).

Any ideas?
I would start by defining a vector

x=1:27

Then scale and shift this as follows

t=-pi/2+pi*(x-1)/26

then take the cosine

Cs_t=cos(t)

This assumes you want to include the endpoints in the vectors, but you didn't say specifically you had to do that.
 
Top