I'm using Octave 3.8.1 which is like matlab, I'm trying to use interpolation and repmat to alter the frequency of signals (since it's so fast doing it this way (.01 seconds) and I have to create 28000+ at a time) I can change the variable num_per_sec to any whole number but if I try to change it to 2.1 or anything with a decimal in it I get an error "error: reshape: can't reshape 44100x2 array to 92610x1 array error: called from: line 10 (the repmat line)" does anyone have a work around for this or another suggestion?
Note: please note that ya is a simple test equation I won't have equations to work with just the signal to work with so just changing the freq variable won't work.
see code below:
clear,clc
fs = 44100; % Sampling frequency
t=linspace(0,2*pi,fs);
freq=1;
ya = sin(freq*t)'; %please note that this is a simple test equation I won't have equations just the signal to work with.
num_per_sec=2 %works
%num_per_sec=2.1 %doesn't work
yb=repmat(ya,num_per_sec,1);%replicate matrix
xxo=linspace(0,1,length(yb))'; %go from 0 to 1 sec can change speed by incr/decr 1
xxi=linspace(0,1,length(ya))'; %go from 0 to 1 sec and get total samplerate from total y value
yi_t=interp1(xxo,yb,xxi,'linear');
plot(yi_t)