Figure out how many samples there are per "cycle" for the purpose of your "10 cycles". The last time for each cycle should end 1 sample before the next full cycle boundary. So for example 10 samples per "cycle" should correspond to relative times 0, 1/10, 2/10, 3/10, 4/10, 5/10, 6/10, 7/10, 8/10, 9/10, and should not go all the way to 1 (which would be 11 samples). If you end up using linspace along the way to generate N points, then use linspace(first_time, last_time, N+1 ) and then throw away the last sample.
Now, generate the list of instantaneous frequencies for each cycle. You should probably limit those to being no more than 1/2 the sampling frequency, to avoid aliasing.
instant_frequency_for_cycle = fs/2 * rand(1, no_of_cycles)
Now replicate each of those by the number of samples per cycle:
f = reshape( repmat( instant_frequency_for_cycle(:), 1, samples_per_cycle ), 1, [])
or if you have a sufficiently new MATLAB,
f = repelem( instant_frequency_for_cycle, samples_per_cycle )
or in any version you can use
f = kron(instant_frequency_for_cycle, ones(1, samples_per_cycle) )
After that it is a simple modification to what you had:
the f*t got changed to f.*t . With f and t being the same length, this gives an instant frequency to every sample.