Error using fminsearch: array exceeds maximum array size preference.
15 次查看(过去 30 天)
显示 更早的评论
Hello,
I got some data of the acceleration of a vibrating system. Using this data I get an estimation of the transfer function between the acceleration of the system and a force applied to the system by using the command 'tfestimate'.
Transforming the equation of motion of the system I derived the analytical transfer function in the Laplace domain which is in the classical form:
F(s)=(a_1*s^n+a_2*s^(n-1)+..+a_n)/((b_1*s^n+b_2*s^(n-1)+..+b_n). I want now to fit the constant parameters minimizing the mean square error between the absolute value of the ideal transfer function (wich I computed) and the absolute value of the transfer function found by Matlab using experimental data.
The ideal transfer function which I computed is defined as:
H1_nom= @(s,m1,m2,c1,c2,k1,k2) s.^2.*(c2*s+k2)./(m1*m2.*s.^4+(m1*c2+m2*(c1+c2)).*s.^3+(m2*(k1+k2)+m1*k2+c1*c2).*s.^2+(k1*c2+k2*c1).*s+k1*k2);
m1,m2 are masses, c1,c2 damping parameters and k1,k2 stiffness parameters.
In order to use the function fminsearch, I make some guess about the estimated values of the four parameters I want to fit, c1,c2,k1,k2, by changing the names and giving following values:
a0=1;
b0=1;
c0=1000;
d0=1500;
guess=[a0,b0,c0,d0];
The experimental transfer function is obtained as mean of five tests as follows:
[Tf11,Fr]=tfestimate(d_dof1(:,2),d_dof1(:,4),[],[],[],Fs);
[Tf12,Fr]=tfestimate(d_dof2(:,2),d_dof2(:,4),[],[],[],Fs);
[Tf13,Fr]=tfestimate(d_dof3(:,2),d_dof3(:,4),[],[],[],Fs);
[Tf14,Fr]=tfestimate(d_dof4(:,2),d_dof4(:,4),[],[],[],Fs);
[Tf15,Fr]=tfestimate(d_dof5(:,2),d_dof5(:,4),[],[],[],Fs);
The second column of the files d_dof contains the output data, fourth column input data. Fs=5120 is sampling rate of data acquisition.
The error I want to minimize is defined as follows:
err1=@(x) rms(Tf1_mean-abs(H1_nom(s,m1,m2,x(1),x(2),x(3),x(4))));
where I recalled the variables c1,c2,m1,m2 as x(1),x(2),x(3),x(4). But now I'm in trouble. Trying to minimize, getting the output x_opt using the command:
x_opt=fminsearch(err1,guess);
I get the following error:
Requested 32769x482549 (235.6GB) array exceeds maximum array size preference. Creation
of arrays greater than this limit may take a long time and cause MATLAB to become
unresponsive. See array size limit or preference panel for more information.
Error in fminsearch (line 200)
fv(:,1) = funfcn(x,varargin{:});
Thanks.
1 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!