0

Dear stackoverflow community

I have been struggeling with the following problem. I have got this code to estimate Parameters with provided Matlab functions for Greybox Modeling. Matlab doesnt give me a step response for my given idnlgrey element. How can that be? If I code one of the given example. I have tried to change the code of one of the given examples regarding greybox identification and the same problems occurrs. I really dont understand what can be the problem here.

clear all; close all; clc;

ParName = {'a'; ... %3x3
    'b'; ... %3x3
    'c' ... %1x1
    };
ParUnit = {'kg'; 'kg/s'; 'm'};
ParValue = {diag([2652.25; 2825.29; 4201.26]); ...
    diag([848.05; 10161.62; 22719.39]); ...
    100};

FileName = 'boat_c';
Order = [3 2 3];
Parameters = struct('Name', ParName, 'Unit', ParUnit, 'Value', ParValue, 'Minimum', 0, 'Maximum', Inf, 'Fixed', false);
Ts = 0;
InitialStates = struct('Name', {'r'; 's'; 't'}, 'Unit', {'m/s'; 'm/s'; '1/s'}, ...
    'Value', [0; 0; 0], 'Minimum', -Inf, 'Maximum', Inf, 'Fixed', true);
nlgr = idnlgrey(FileName, Order, Parameters, InitialStates, Ts, 'Name', 'Boot', ...
    'InputName', {'x'; 'y'}, 'InputUnit', {'N'; 'rad'}, ...
    'OutputName', {'r'; 's'; 't'}, 'OutputUnit', {'m/s'; 'm/s'; '1/s'}, 'TimeUnit', 's');
step(nlgr)

function [dx, y] = boat_c(t, x, u, m, d, varargin)
 y = [x(1); x(2); x(3)];
 dx = [m(2,2)/m(1,1)*x(2)*x(3)-d(1,1)/m(1,1)*x(1)+u(1)*cos(u(2))/m(1,1); ...
     -m(1,1)/m(2,2)*x(1)*x(3)-d(2,2)*m(2,2)*x(2)+u(1)*sin(u(2))/m(2,2); ...
     (m(1,1)-m(2,2))/m(3,3)*x(1)*x(2)-d(3,3)/m(3,3)*x(3)+L/2*u(1)*sin(u(2))/m(3,3)];
 end
Benjamin
  • 1
  • 1
  • Can you create an [mre]? Currently if I try to run your code I get an error `No default options available for the function 'lsqnonlin'`. Is that your problem as well? If so, please rewrite your question with the [mre], the error you're getting and the things your find in your own research when you google the error. Thanks! – Saaru Lindestøkke Aug 31 '21 at 12:07
  • Please trim your code to make it easier to find your problem. Follow these guidelines to create a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example). – Community Aug 31 '21 at 12:19
  • I hope that I could trim my code. Actually, there is supposed to be data which is simulated by a SIMULINK model by which the 'nlgreyest' estimation should estimate the parameters. Me and a supervisor from my university detected a problem with the function 'boat_c'. MATLAB does not load the input u for the idnlgrey-object. We figured that out by loading the step response of the system. Here, MATLAB does not return anything. So, the question now is, why there is not step response? – Benjamin Sep 08 '21 at 09:05

0 Answers0