f



Help!! Help!! Help!!

I wish to vectorize the following code:

s = tf('s');
W = logspace(-1,2,50);
COMBINATION = combn(W, 2);
K = cell(length(COMBINATION), 1);
K0 = 1 + (1/(2*s)) + 0.5*s/(0.2*s + 1); % PID controller to be approximated as PI
gapValue = zeros(length(COMBINATION), 1);

for i = 1:length(COMBINATION)
      K{i} = (COMBINATION(i,1)*(1 + (1/(COMBINATION(i,2)*s)))); % PI controller
end

for i = 1:length(COMBINATION)
    gapValue(i,1) = gapmetric(K0, K{i});
end

where K0 is the Nominal transfer function and K is a cell array including transfer functions whose gap metric from K0 are to be calculated.

Is there a way to vectorize the call of   "gapmetric" functiooon?
This takes too long as a for loop. Thanks to anyone that can help.

ALi 
0
Ali
12/11/2010 1:18:06 PM
comp.soft-sys.matlab 211266 articles. 17 followers. lunamoonmoon (258) is leader. Post Follow

0 Replies
2754 Views

Similar Articles

[PageSpeed] 15

Reply: