MATLAB: Sinusoidal Random Vector question

frequencyMATLAB

I want to create a vector of the same length as another vector called variable t. Typically, I would just use linspac; however, I do not want a linear regression. preferably, I'd like to make a sinusoidal regression if at all possible… if not any non-linear regression will do. What's the best way to go about this?

Best Answer

This is just a guess.
f1 = 4500;
f2 = 4700;
x = (sin(linspace(-pi/2,pi/2,20))+1)/2*(f2-f1) + f1;
plot(x)
But it is not random. Do you also want something that is random? You did say random in the original question, but in the comment, you said nothing about randomness.