How to introduce a phase shift to a existing vector
조회 수: 53(최근 30일)
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?
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
Jan 2019년 8월 4일
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.
Xingda Chen 2022년 11월 6일
Perhaps this is what you are looking for:
p_freq = 5e3; p_period = 1/p_freq; %you have to know your frequency
move_this_many_sampling=round(((phase_i_want_to_shift_in_degree/360)*p_period)/samp_period)% and your sampling rate
off course this would mean you would need to have more data that you want to show in the window (at least +-1 period)
plot(t,real_waveform(1,[window_start:num_item+window_end])) %window_start-- the first sample you want to see/use, window_end-- the last sample you want to see/use, num_item-- the number of samples you want to see/use
I am doing similar task for my project and here is what I got
David Goodmanson 2022년 11월 8일
I assume that you are given the oscillatory function V in an array, with no accompanying array for the independent variable to set the horizontal scale. In the example, the array has 10001 points and 50 oscillations, so it is a good candidate for the hilbert function. (The hilbert function is not the Hilbert transform, but it makes use of the Hilbert transform. See help hilbert).
t = 0:100e-6:1;
V = sin(2*pi*50*t);
clear t % unknown horizontal scale now
n = length(V)
z = hilbert(V);
a = (unwrap(angle(z)));
V30 = cos(a+pi/6); % 30 degree offset
xlim([4000 5000]) % use just part of the array to expand the plot