How to strore previous condition of variable ?

2 ビュー (過去 30 日間)
Maciej Wroz
Maciej Wroz 2017 年 4 月 2 日
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 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by