From: Ali on
Hello

I'm trying to use GreyBox modeling with pem and a state space equation to try to find the coefficent of friction for a 1 degree of freedom vibrating system (spring mass damper system) I get a weird graph when i compare the results from the ODE45 solver and the measured data...
my data is 2001 samples simulated with SIMMECHANICS with 1000 Hz sample rate
Here is what i Have so far:

z = iddata(output1dof,[],0.001,'Name','SM1dof');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
My function file that i have the state space equation in:

function [dx, y] = mass_m(t, x, u, m, k, c,varargin)
%PENDULUM_M A pendulum system.

% Output equation.
y = x(1); % position.

% State equations.
dx = [x(2); ... % Angular position.
((-k/m)*x(1)) + ((-c/m)*x(2)) ... % Angular velocity.
];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

FileName = 'mass_m'; % File describing the model structure.
Order = [1 0 2]; % Model orders [ny nu nx].
Parameters = [0.025; 3000; 0.15]; % Initial parameters.
InitialStates = [1; 0]; % Initial initial states.
Ts = 0; % Time-continuous system.

nlgrrk45 = nlgr;
nlgrrk45.Algorithm.SimulationOptions.Solver = 'ode45'; % Runge-Kutta 45.
>> figure;
compare(z, nlgrrk45, 1, 'init', 'm');


THIS IS where it goes crazy... the graph looks ridiculous and it predicts the data with something like (-1.0 e6) accuracy

Any help would be appreciated ... It should be noted that I tried to use the "A Classical Pendulum : Some Algorithm Related Issues" in the help as a guide...

Thanks in advance
From: Ali on
There should be a:
nlgr = idnlgrey(FileName, Order, Parameters, InitialStates, Ts)


after Ts=0;

It's in my code but i forgot to add it here... still doesn't work!
 | 
Pages: 1
Prev: matlab script editing
Next: hello