How can I call an array of letters into a for loop?
1 ビュー (過去 30 日間)
I would like to setup this for loop to output each interation of with the coorasponding part of my homework. I can do it all individually but that doesn't seem efficient. Every way I have tried outputs to cooresponding integer and not the actual character (a,b,c,d)
I would like it to read:
The open loop poles for part c are:
Closed loop system is stable for part c.
Gain Margin for part c is: 20.000000.
Phase Margin part c is: 78.689008.
Time delay Margin for part c is: 1.386851.
k = [200 100 100 80];
a = [1 1 0 1];
z = [1 0.1 1 1];
w = 10;
s = tf('s');
C = [65 66 67 68];
letters = char(C)
L = k(i)/ ((s+a(i))*(s^2 + 2*z(i)*w*s + w^2));
[top, bottom] = tfdata(L);
fprintf('The open loop poles for part %f are:\n', letters(i))
marg = allmargin(L);
if marg.Stable == 1
fprintf('Closed loop system is stable for part %f.', letters(i))
fprintf('The closed loop system is not stable for part%f.', letters(i))
fprintf('Gain Margin for part %f is: %f.\n', letters(i) , marg.GainMargin)
fprintf('Phase Margin for part %f is: %f.\n', letters(i) , marg.PhaseMargin)
fprintf('Time delay Margin for part %f is: %f.\n\n', letters(i) , marg.DelayMargin)