Back calculating Ki from test data
Show older comments
Hello,
I have a simple PI loop that I am tying to back calculate Ki using test data. From the loop, Ki is given by the below equation:
[Current Trim Value - Previous Trim Value] / Error*Kp*Ts. I have test data for the Error and Trim in the form or an m x 1 array. Any idea ow I can do this? The main challenge I am having is how to calculate [Current Trim Value - Previous Trim Value] from the data. I tried using the following for loop to do it, but I get an error saying "Array inddices must be positive integers or logical values"
for j = 1: length(TrimArray)
Ki(j) = [TrimArray(j) - TrimArray(j-1)] / Error(j)*Kp*Ts
end
I see why I get that error I'm getting because at J = 1, you can have index number = 0. Note that TrimArray and Error are test data recorded at 50Hz.
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!