I want to phase shift a sinusoidal wave as shown below.
What is happening here is that a phase shift occurs at the point of the red line. So, instead of following its natural path(dotted lines), it begins to follow the shifted path(dashed line).
I have tried to code it as follows.
clear;
t =(0:10000)/10000';
for ii = 1:length(t)
x(ii)=exp(i*2*100*t(ii));
if ii == 235 % point at which the phase shift occurs
x(ii) = x(ii)*exp(-i*(pi/4));
end
end
plot(t,real(x));
Can someone tell me the mistake in my code?