Real Time System Identification Problem
12 views (last 30 days)
Show older comments
Hi everyone, I aim to build a model of my system using real-time data. My system is a MIMO (Multiple Input Multiple Output) system, where the inputs are RPM and rudder angle, and the outputs are linear velocity and angular velocity.
First, I collected the data. Since the angular velocity measurements were noisy, I applied a filtering process to clean the signal. The system operates in discrete time at a frequency of 50 Hz, so I created an iddata object accordingly.
Next, I used MATLAB's System Identification Toolbox to identify a state-space model. The resulting model had a good fit to the data and a relatively low model order.
To evaluate the generalization performance of the identified model, I used the lsim function to simulate the model with RPM and rudder angle inputs from a different log file. The different log file inputs and outputs are same range with the log wihch i used for training model. I then compared the simulated outputs to the actual measured linear and angular velocities from that dataset. Result is below one. As you see it isn't accurate. Where is the problem or do you have recommendation?
https://ibb.co/WWbqPVHR
2 Comments
Answers (1)
Mathieu NOE
on 9 Jul 2025
Edited: Mathieu NOE
on 9 Jul 2025
hello again
well this is only a first rapid trial... without big success unfortunetaly
(and I wished you had also posted your code and results for comparison)
according to the problem description are we talking about a boat ? (rpm, rudder) or an aircraft ?
anyway , what I have finally figured out from the physics of your problem is that there is no simple relationship between rpm and speed as we are not here dealing with "mechanical systems" or "gears" or whatever system with a "rigid" connection between input and output.
the speed of a boat or a prop plane will of course increase with rpm (assuming fixed pitch) but not in a linear manner
there may be some delay (on top of the non linear relationship once in steady condition)
so I doubt that you can fit a simple model here (but I may be wrong)
here I finally opted to look only speed vs rpm as the other input seems to have limited impact on this output , and using onlly a first order model with delay : even if the trend is not too bad, clearly there is a problem with the "gain" and probably with the starting conditions /offsets... wish the data would start with rpm = 0 and show the initial rpm ramp up
T = readtable('train_combined_data.csv'); % angular_velocity_z,throttle,nozzle_angle,speed
Fs = 50;
dt = 1/Fs;
% a quick look at the data
stackedplot(T)
% inputs : throttle (RPM), nozzle_angle (rudder angle) (cols 2 & 3)
throttle = T.throttle;
nozzle_angle= T.nozzle_angle;
% inputs = [throttle nozzle_angle];
inputs = [throttle];
% outputs : angular_velocity_z, speed (linear velocity) (cols 1 & 4)
angular_velocity_z = T.angular_velocity_z;
speed= T.speed;
% angular_velocity_z_s = smoothdata(angular_velocity_z,'gaussian',50);
angular_velocity_z_s = smoothdata(angular_velocity_z,'movmedian',150);
% smooth the angular_velocity_z
figure
plot(angular_velocity_z)
hold on
plot(angular_velocity_z_s)
hold off
% smooth the speed
speed_s = smoothdata(speed,'movmedian',50);
figure
plot(speed)
hold on
plot(speed_s)
hold off
% outputs = [angular_velocity_z_s speed_s];
outputs = [speed_s];
% let's see roughly how speed evolves vs rpm and nozzle_angle
figure,
plot(speed_s), hold on
plot(throttle/1000)
plot(nozzle_angle/1000)
hold off
legend('speed','throttle/1000','nozzle_angle/1000');
% obviously there is some correlation between spedd and rpm ,effect of
% nozzle_angle is not that noticeable
% Hypothesis : let's try to identify a simple first order model (with
% delay) between speed and rpm
data = iddata(outputs,inputs,dt);
% Create a 1st-order process model with delays and a zero
delay1 = 1;
model = idproc('P1ZD', 'TimeUnit', 'seconds', 'InputDelay', delay1);
% Estimate Model Parameters: Fit the model to your data using the procest function.
estimatedModel = procest(data, model);
% Validate the Model: Compare the model's output with the actual data to ensure accuracy.
compare(data, estimatedModel);
% Analyze Results: View the identified parameters and delays:
estimatedModel.Report.Parameters
% Create a 1st-order process model with delays and no zero
delay1 = 1;
model = idproc('P1D', 'TimeUnit', 'seconds', 'InputDelay', delay1);
% Estimate Model Parameters: Fit the model to your data using the procest function.
estimatedModel = procest(data, model);
% Validate the Model: Compare the model's output with the actual data to ensure accuracy.
compare(data, estimatedModel);
% Analyze Results: View the identified parameters and delays:
estimatedModel.Report.Parameters
1 Comment
Mathieu NOE
on 9 Jul 2025
1/ just found this info boat speed vs rpm : it's not linear , especially under 3000 rpm

it improves above 3000 rpm but that may be only valid for a specific size / type of prop (and I am not sure the data are about a boat...

2/ the zero in the model I choose is not physically meaningfull, but if you remove it from the model structure the match is even worse..
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




