Error using iddata, Each experiment in the data set must have the same number of input and output measurements (rows)
22 ビュー (過去 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 日
As far as I can tell / remember , the operationnal modal analysis codes are based on a simple "string" model , in other words we consider only 1D aligned sensors / signals ; I haven't seen any matlab code for a 2D layout
so we are limited to take only one row of sensors at a time
ok so combining your last message infos with previous one :
the first row's order from left to right is : AFE→C7E→C83→C6F→C80,
the second row's order from left to right is: C6C→C6E→CA7→C76→C7F.
We finally can only use fewer points
C6C_M1 , C6E_1 , C6F_1 , C7E_M1 , C80_1 ,CA7_1
first row's : only 3 points valid : C7E_M1→C6F_1→C80_1
second row's: only 3 points valid C6C_M1→C6E_1→CA7_1
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 件)
参考
カテゴリ
Help Center および File Exchange で Linear Model Identification についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!