Mapping Saw Wave That Is Between -1 And 1 To A Sine Wave 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);
You can scale your sawtooth before you put it into the sine function, like so:

f=(-1:1/128:1)';

ramp = f * (length(f)-1)/length(f);  % Scale down to not include the last 1 into the sine
c1=repmat(ramp,1000,1);

c2=sin(pi*c1);   % -1 of saw wave maps to 0, 1 maps also to 0 


plot([c1 c2]);
%sound(c2, 44100);