How do we write a code for a periodic intermittent scalar function?
Ältere Kommentare anzeigen
I would like to write a code of an periodic intermittent bounded control. I've tried to write it as a piecewise function but its not giving me type of output I want. Can someone help please? This what I have written
K = 0:0.01:1;
Pk =[];
m = 4; h = 0.1; T = 0.05;
for k = 1:length(K)
if (K(k) >= m*T & K(k) < m*T + h)
pk = 4;
elseif (K(k) >= m*T + h & K(k) < (m+1)*T)
pk = 0;
end
Pk = [Pk pk];
end
4 Kommentare
madhan ravi
am 9 Nov. 2018
you need to explain what result you are expecting and why do you think the above code is wrong
Eric Mwanandiye
am 9 Nov. 2018
Bearbeitet: Eric Mwanandiye
am 9 Nov. 2018
Eric Mwanandiye
am 9 Nov. 2018
Walter Roberson
am 9 Nov. 2018
And what do you expect instead?
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

