System Identification of Slide Dynamics in Velocity Mode
Total Page:16
File Type:pdf, Size:1020Kb
System Identification of Slide Dynamics in Velocity Mode
You need Matlab and the System Identification Toolbox.
1. Load the .mat file containing your data. In this guide, we assume that the name is “second.mat”. 2. Type the variable name in the workspace :
>> second second = X: [1x1 struct] Y: [1x2 struct] Description: [1x1 struct] RTProgram: [1x1 struct] Capture: [1x1 struct]
The variable is in the structure format. You address fields and subfields using a period.
>> second.Capture ans = Length: 30 Downsampling: 1 DateTime: '02/10/2008 11:23:40' Task: 1 SamplingPeriod: 0.0001 TriggerState: 'off' TriggerSignal: '' TriggerDelay: 0 TriggerLevel: 0 TriggerEdge: 'neg'
3. Store the sampling period to a variable:
>> Ts=1e-4;
4. Store the time vector, the input and the output (note the use of transpose):
>>t=second.X.Data'; >> in=second.Y(2).Data’; >> out=second.Y(1).Data’;
NOTE: Y(1) and Y(2) might need to be switched. It depends on the order in which they were saved in ControlDesk. Check by plotting against time and re-define if necessary. 5. Save the variables Ts, in, out and t in a new .mat file (>>save filename Ts in out t) 6. Invoke the system identification toolbox using >>ident 7. Import Data/Time Domain Data. Type in and out in the appropriate fields, enter 0 for the starting time and Ts for the sampling interval. 8. Check Time Plot to verify the import. 9. Do not de-trend the data and do not remove means. 10. Choose Estimate/Parametric Models. Choose output error structure (OE) and leave the orders at 2 2 1. It will estimate a discrete transfer function with two poles and at most 2 zeroes. Set the initial state to zero and estimate. 11. Once the estimation is complete, click on Model Output to see a comparison between predicted and measured data, along with a score (100 indicates a perfect match). 12. If the prediction is accurate (score of 80 or better), export the model to the Workspace and save the session. 13. The workspace variable is in system object format. Suppose it's called oe221. Extract the discrete-time system matrices with: >>[Ad,Bd,Cd,Dd]=ssdata(oe221); 14. The above state-space matrices correspond to a discrete-time model. To convert to continuous-time use: >>sys_d=ss(Ad,Bd,Cd,Dd,Ts); >>sys_c=d2c(sys_d,'zoh') >>[A,B,C,D]=ssdata(sys_c); 15. Save the identified model matrices A,B,C,D to a new .mat file with a descriptive name. 16. You can display the Bode plot of the model using >>bode(sys_c) for comparison with the one obtained with the HP analyzer.