Why when plotting - no Phase change of 180 degrees ?

2 views (last 30 days)
STP
STP on 28 Mar 2019
Edited: STP on 1 Apr 2019
I would like to change phase of my inputs as per:
Is the below correct interpretation? It should be a particular phase , then phase ramp, then 180 degrees shift, then nothing. I don't my below code is doing that
Ek1 = exp(1)^(1i*pi);
phi= pi/2;
k = -phi./(t2a(1)-t1(1));
Ek2a = @(t) exp(1)^(1i*(phi + k.*(t-t1(1))));
Ek2b = exp(1)^(1i*0);
Ek3 = 0;

Answers (1)

darova
darova on 28 Mar 2019
maybe you need a function:
function res = Ek(t)
% t1 =
% t1B =
% t2 =
phi0 = pi/2;
k = -phi0/(t1B-t1);
res = zeros(size(t));
for i = 1:length(t)
if t(i) < t1
res(i) = exp(1i*pi);
elseif t1 <= t(i) && t(i) < t1B
res(i) = exp(1i*(phi0 + k*[t(i)-t1]));
elseif t1B <= t(i) && t(i) < t2
res(i) = exp(0i); % or just 1
else
res(i) = 0;
end
end
end
  3 Comments
darova
darova on 28 Mar 2019
Dont understand
k = -phi./(t2a(1)-t1(1)); % you mean: k = -phi./(t1B - t1)?
STP
STP on 29 Mar 2019
Edited: STP on 1 Apr 2019
Yup the same. Is it wrong?

Sign in to comment.

Categories

Find more on Audio I/O and Waveform Generation in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!