## How to introduce a phase shift to a existing vector

### Bharath Kumar S (view profile)

on 4 Aug 2019
Latest activity Commented on by Jan

### Jan (view profile)

on 5 Aug 2019
Hello all,
Kindly help me on this.
I have a existing vector signal of length times. I need to introduce an phase shift to the signal say lag 30 deg.
How to proceed on this?
eg:
t = 0:100e-6:1;
V = sin(2*pi*50*t); % say V is my existing vector signal from Comtrade / TFR or from other sources
Est_V = V *( phaseshift); %% I need to introduce phase shift
Thanks
BS

### Jan (view profile)

on 4 Aug 2019

This is not possible, if you do not have additional information. You can apply a phase shift with a certain number of elements, or if you have the relation between time and index: about a certain time. But without havinbg the formula, but only the signal, you cannot apply a phase shift, because you do not knwo the frequency. See this:
v = rand(1, 1000);
Now you cannot apply a shift by 30 degree.

Bharath Kumar S

### Bharath Kumar S (view profile)

on 4 Aug 2019
Hi Jan,
frequency of the input signal is say 50 Hz, V1 is a sine vector through length of times(t).
Now i need to introduce a phaseshift to existing V1 signal and assign this new vector as V2..
On plotting V1 & V2, it should match exactly. Hope now the question is clear.
t = 0:100e-6:1;
freq = 50; %% hertz
V1= sin(2*pi*freq*t); % say V is my existing vector signal from Comtrade / TFR or from other sources
V2 = V *( phaseshift); %% I need to introduce phase shift
Jan

### Jan (view profile)

on 5 Aug 2019
Maybe you mean:
t = 0:100e-6:1;
freq = 50; %% hertz
V1 = sin(2*pi*freq*t);
phase = round(numel(t) / freq);
V2 = [zeros(1, phase), V1(1:end-phase)];
plot(t, V1);
hold('on');
plot(t, V2, 'o');
I understand "On plotting V1 & V2, it should match exactly" such that you want a phase shift about 1 period. Number of time steps is not a multiple of the frequency, an 100% phase-shifting is not possible (see the round command).