Why when plotting - no Phase change of 180 degrees ?

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)

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

STP
STP on 28 Mar 2019
Edited: STP on 28 Mar 2019
Hi thanks for your answer, a function is not required. Just that my Ek2a is correct or not?
Cuz I am unable to plot (t, Ek) to see the phase changing slowly in t2a region
Ek = [Ek1; Ek2a; Ek2b; Ek3]
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 Aerospace Applications in Help Center and File Exchange

Tags

Asked:

STP
on 28 Mar 2019

Edited:

STP
on 1 Apr 2019

Community Treasure Hunt

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

Start Hunting!