[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Sine wave code
From: |
Blaz |
Subject: |
Re: Sine wave code |
Date: |
Tue, 29 Dec 2020 09:32:25 -0600 (CST) |
Sure
u(k) and ipp(k) are the values that need to be cut if u(k) is above the
Cutoff value. This code cuts the sine wave but only until the sine value is
higher than the Cutoff value. I would like to prolong this until the next
zero crossing, but Im missing something.
------------------------------------------------------------------------
for k=1:1:n
uac(k)=(ip(k)/CT)*(Rct+Rb);
u(k)=uac(k)*kdc*krem;
if (k > 1) && (ip(k)*ip(k-1) < 0) %zero crossings
zx = 1;
else
zx = 0;
end
if abs(u(k)) < Cutoff
ipp(k) = ip(k);
elseif u(k) > 0
ipp(k) = Ippmax;
elseif u(k) < 0
ipp(k) = -Ippmax;
end
if u(k) > 0 % cutoff Value check
u(k) = Cutoff;
end
if u(k) < 0
u(k) = -Cutoff;
end
if ipp(k) == 0 % zero crossing
j = 0;
end
if zx > 0
j = 1;
end
integral(k)=j;
CTsat(k) = abs(sign(ipp(k)));%*integral(k)); % izracunamo obmocje
nasicenja
end
--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
Re: Sine wave code, Sergei Steshenko, 2020/12/29