I am trying to map values of a saw-wave that goes from -1 minimum value to 1 maximum value as a periodic signal onto a sine-wave. Repeating the matrix of this waveform that is 257 element in length oscillates as expected as a saw-wave, but if I change the function into a sine-wave -1 maps to 0, then 1 also maps to 0, and when two zeros are together when we loop the waveform with "repmat" matlab function, there appears discontinuities in the sine-wave function...How can I map this saw-wave, so the sine-wave perfectly oscillates with all the values used from the saw-wave that is between -1 and 1 values?
f=(-1:1/128:1)'; c1=repmat(f,1000,1); c2=sin(pi*c1); % -1 of saw wave maps to 0, 1 maps also to 0 sound(c2,44100); % two adjacent 0's cause discontinuities
I also tried the fft method which gives me the needed coefficients but if my waveform is complex this would become more complicated to adapt:
f=(-1:1/128:1)'; m=fft(f); m(3:256)=0; m(1)=0; m2=ifft(m); m3=m2/max(abs(m2)); m4=repmat(m3,1000,1); sound(m4,44100);