How to introduce a phase shift to a existing vector

67 次查看(过去 30 天)
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

回答(3 个)

Jan
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.
  2 个评论
Bharath Kumar S
Bharath Kumar S 2019-8-4
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 2019-8-5
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).

请先登录,再进行评论。


Xingda Chen
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
hold on
plot(t,real_waveform(1,[window_start+move_this_many_sampling:(num_item+window_start+move_this_many_sampling)]))
I am doing similar task for my project and here is what I got

David Goodmanson
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
figure(1)
plot(1:n,V,1:n,V30)
grid on
xlim([4000 5000]) % use just part of the array to expand the plot
ylim([-1.1 1.1])

类别

Help CenterFile Exchange 中查找有关 Transmitters and Receivers 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by