How to strore previous condition of variable ?
1 view (last 30 days)
Show older comments
Hi, I want to create function which simulate dead time effect in three phase inverter. Part of my code is shown below:
function [y_1A, y_2A, krok] = dead_time(kA, kA_p, kA_n, kA_np, k_p)
y_1A = logical(kA);
y_2A = logical(kA_n);
krok = k_p;
znacznik = 0;
if (kA_np == true && kA_n == false)
y_1A = false;
znacznik = 1;
end
if znacznik == 1
krok = krok + 1;
if krok == 5
znacznik = 0;
y_1A = true;
krok = 0;
end
end
variables: kA_np - previous condition of kA_n; kA_p - previous condition of kA; znacznik - marker; krok - step;
This function should wait five steps (five iterations) before set y_1A condition to 1, but it works only for one iteration. Variable "krok" is rises to value of 4 and it is not reset. Have you any ideas how should I do that?
Thank you for your help/answers.
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!