Filter löschen
Filter löschen

How to strore previous condition of variable ?

2 Ansichten (letzte 30 Tage)
Maciej Wroz
Maciej Wroz am 2 Apr. 2017
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.

Antworten (0)

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by