You are attempting to assign a vector (the output of chirp
) to a single element of a matrix (mat
). This won't work. You could use a cell array instead. In the example below I've replaced mat
with a cell array, outArray
.
Fs = 32000; %Sampling Frequency
t = 0: 1/Fs: 10 -1/Fs; %Time
tt = 10; %Time when the chance occurs
f1 = 20; %Starting Frequency
f2 = 250; %Ending Frequency
cosineph = zeros(1,40); %Phase of cosines
for iMat= 1:40
k=iMat/2;
outArray{iMat} = chirp(t,k*f1,tt,k*f2,'linear',cosineph(iMat));
end