dirk1000

5 Reputation

One Badge

3 years, 135 days

MaplePrimes Activity


These are replies submitted by dirk1000

Hi,

I see that you also use those 'evaluation quotes' around functions when plotting.  That made me think of one of my many previous attempts but this time it worked.  Not sure why it didn't work the first time.  Thank you very much for the hint!

P.S.: I've also added some slice plots to show clearly the effect of the duty cycle which I intended to achieve.  That might not have been clear in my questions.

Status: solved.
 

restart;
with(plots):

f1 := (x, t) -> A * (1 + B * sin(a*x-b*t));

proc (x, t) options operator, arrow; A*(1+B*sin(a*x-b*t)) end proc

(1)

f2 := (x, t) -> C * (1 + E * sin(c*x-d*t));

proc (x, t) options operator, arrow; C*(1+E*sin(c*x-d*t)) end proc

(2)

A:=1: B:=0.5: a:=100: b:=1:
C:=1: E:=0.5: c:=10: d:=10:

densityplot(f1(x,t) * f2(x,t), x = 0..1, t = 0..10, style=patchnogrid);

 

#Duty cycle (DC) applied to f2
# ON state:      n*T <= t <(n+q)*T  : f2__DC(x,t)=f2(x,t-n*(1-q)*T)
# OFF state: (n+q)*T <= t < (n+1)*T : f2__DC(x,t)=0 (so all other cases)
# (n is a positive integer, zero included, and n=floor(t/T))
T:=1:
q:=0.5; #fraction of T where DC is 1=ON

.5

(3)

f2__DC:=proc(x,t):
  local n, res;
  n:=floor(t/T):
  if (t>=(n+q)*T) and (t<(n+1)*T) then
    res:=0;
  else
    res:=f2(x,t-n*(1-q)*T);
  end if;
  res;
end proc:
densityplot(f1(x,t) * 'f2__DC'(x,t), x = 0..1, t = 0..10, style=patchnogrid);

 

plot('f2__DC'(0.05,t),t=0..10);
plot(f1(0.05,t) * 'f2__DC'(0.05,t),t=0..10);

 

 

NULL


 

Download dutycycle_solved.mw

Page 1 of 1