
Error using iddata, Each experiment in the data set must have the same number of input and output measurements (rows)
12 ビュー (過去 30 日間)
表示 古いコメント
Hi there,
I am trying to get the vibration frequency with time and acceleration data by system identification using ERA method, when I run the data, there was an error as: error using iddata, Each experiment in the data set must have the same number of input and output measurements (rows). File and code are attached.
Thanks
load C7E_1.mat t acc dt;
rng('default');
% Add noise
% we add to the excitation and response signals
t = t + randn(size(acc))/1250;
acc = acc + randn(size(acc))/1e11;
% Define outputs from the above function
t = (0:size(t,1)-1)/dt';
X1 = 1e2*t;
Y1 = 1e2*acc;
X0 = X1;
Y0 = Y1(:,1);
subplot(2,1,1)
plot(t,X0)
xlabel('Time (in seconds)')
ylabel('Force (in Newtons)')
grid on;
title('Excitation and Response for the vibration frequency')
subplot(2,1,2)
plot(t,Y0)
xlabel('Time (in seconds)')
ylabel('Displacement (in meters)')
grid on;
%%
% time in a given sample
Ts = 1/t';
% estimation data
% requires System Identification Toolbox.
data_estimation = iddata(Y0(1:1000), X0(1:1000), 1/dt);
% validation data
data_validation = iddata(Y0(1001:2000), X0(1001:2000), 1/dt);
figure
plot(data_estimation)
[~,inputDelay] = max(data_estimation.InputData);
data_estimation = data_estimation(inputDelay:end);
L = length(data_estimation.InputData);
t = seconds(data_estimation.Tstart + (0:L-1)'*Ts);
y1 = data_estimation.OutputData;
tt = timetable(t,y1);
order = 6;
sys = era(tt, order, 'Feedthrough', true);
compare(data_validation,sys);
sys2 = ssest(data_estimation, order, 'Feedthrough', true);
compare(data_validation,sys,sys2);
legend('Validation data','ERA','SSEST');
%%
% Model Evaluation
[~,f] = modalfrf(sys);
[fd, zeta] = modalfit(sys,f,3);
zeta;
fd;
[frf,f] = modalfrf(sys2);
[fd, zeta] = modalfit(sys2,f,3);
%%
%Model Comparison
% lower order
order = 4;
sys = era(tt, order, 'Feedthrough', true);
sys2 = ssest(data_estimation, order, 'Feedthrough', true);
%model comparison with higher order = 6
compare(data_validation,sys,sys2);
legend('Validation data','ERA','SSEST');
13 件のコメント
Mathieu NOE
2022 年 12 月 14 日
I did a few checks on the listed "valid" sensors
the problem I have is why the data have different durations ??
we need all data being recorded synchro and same duration otherwise no modal analysis code will work
list = readlines('valid.txt');
for k = 1:numel(list)
filename = char(list(k));
F = fullfile(pwd, filename);
load(F);
% main code
Fs = 1/dt;
acc = detrend(acc,'linear');
%% decimate (if needed)
% NB : decim = 1 will do nothing (output = input)
decim = 2;
if decim>1
acc = decimate(acc ,decim);
Fs = Fs/decim;
end
samples = numel(acc);
t = (0:samples-1)*dt;
% convert to displacement
fc1 = 0.5;
fc2 = 2;
[B,A] = butter(2,2*[fc1 fc2]/Fs);
depl = filter(B,A,acc);
figure(k)
subplot(211)
plot(t,depl)
xlabel('time (s)')
ylabel(' r_z (m)')
title(['Displ record from sensor no ' strrep(filename,'_','-')])
subplot(212)
pwelch(depl,[],[],[],Fs)
set(gca,'xscale','log')
title(['PSD estimate from sensor no ' strrep(filename,'_','-')])
end
回答 (0 件)
参考
カテゴリ
Find more on Linear Model Identification in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!