danielmartensson / mataveid Goto Github PK
View Code? Open in Web Editor NEWSystem identification toolbox for GNU Octave and MATLAB
License: MIT License
System identification toolbox for GNU Octave and MATLAB
License: MIT License
In MATLAB, quadprog
is in the Optimization Toolbox. I would recommend adding some code that checks for the Optimization Toolbox before making this call.
Similar to #DanielMartensson/MataveControl#4, ocid.m is not MATLAB compatible.
Multiple variables can be defined without coma or semicolon and multiple equal signed in OCTAVE but this is not allowed in MATLAB.
I am working on a pull request to fix some these issues.
First todo
I have just tried to execute the RLS example under Octave 5.2.0. I get the following error:
Attribute "sampleTime" is not known in Octave transfer function object. When I code Gd.tsam = sampleTime in rls.m the next error occurs.
To me it seems like the code is not really usable with Octave although the first sentence in the description suggests so...
Access to repos
Dear Professor,
Thanks for your sharing your codes. I have a problem when I use OKID in practice.
Here is the problem:
error: svd: cannot take SVD of matrix containing Inf or NaN values
error: called from
okid >eradcokid at line 200 column 11
okid at line 142 column 13
OKID_motor at line 24 column 11
The reason is the following function has no output.
Ybar = y_part*inv(V'V + regularizationeye(size(V'*V)))*V';
Here is the output on terminal
Ybar =
Columns 1 through 37:
NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
Columns 38 through 74:
NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
...
...
...
How should I fix this problem?
Thanks again.
Regards
The Sindy example in MATLAB is not working.
I modified the code of the example only slightly so that some indexing issues don't stop MATLAB. Instead, we end up erroring out at line 159. See stack trace below. The code completes in Octave.
clc; clear; close all;
% Load CSV data
X = csvread('..\data\MotorRotation.csv'); % Can be found in the folder "data"
t = X(:, 1);
u = X(:, 2);
y = X(:, 3);
sampleTime = 0.02;
% Do filtering of y
y = filtfilt2(y', t', 0.1)';
% Sindy - Sparce identification Dynamics
activations = [1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; % Enable or disable the candidate functions such as sin(u), x^2, sqrt(y) etc...
lambda = 0.05;
l = length(u);
h = floor(l/2);
s = ceil(l/2);
fx_up = sindy(u(1:h), y(1:h), activations, lambda, sampleTime); % We go up
fx_down = sindy(u(s:end), y(s:end), activations, lambda, sampleTime); % We go down
% Simulation up
x0 = y(1);
u_up = u(1:h);
u_up = u_up(1:100:end)';
stepTime = 1.2;
[x_up, t] = nlsim(fx_up, u_up, x0, stepTime, 'ode15s');
% Simulation down
x0 = y(s);
u_down = u(s:end)
u_down = u_down(1:100:end)';
stepTime = 1.2;
[x_down, t] = nlsim(fx_down, u_down, x0, stepTime, 'ode15s');
% Compare
figure
plot([x_up x_down])
hold on
plot(y(1:100:end));
legend('Simulation', 'Measurement')
ylabel('Rotation')
xlabel('Time')
grid on
Thank you for your open source, but there are some problems in running the example code:ss function
help ss
ss - Create state-space model, convert to state-space model
This MATLAB function creates a state-space model object representing the
continuous-time state-space model
sys = ss(A,B,C,D)
another problem is missing raw data
The dimensions of w and e are inconsistent.
https://github.com/DanielMartensson/Mataveid/blob/def69941082b43328c1638d196c338157c001997/sourcecode/cca.m#L143
I find these useful for tracking software projects. Consider using:
Semantic Versioning:
https://semver.org/
conventional commits:
https://www.conventionalcommits.org/en/v1.0.0/
MATLAB recommends not using inv for solving A*x=b
. Here is the output from the MATLAB IDE:
The matrix V'*V
is formed twice. Using size information to form eye() part of the equation would be a better choice.
Relevant documentation:
https://github.com/jasonnicholson/regularizeNd/blob/main/.github/Developer%20Documentation.md
Dear professor, It's generous of you to share this project . But I have a question that what is the specific value of input(u) in README.md, such as command lsim(G, u, t). I'm a beginner, it's a little diffcult for me to guess the value of u. Can you upload a more detailed version of 'Typical use' at your convenience or just tell me the value of u?
Replace endfunction with end.
Should there be a multiply sign between hankel(g) and (1:length(g)/2,1+k:length(g)/2+k)?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.