An error occurred while propagating data type 'double' through...

176 views (last 30 days)
Dear
I'm doing an iterative algorithm in MATLAB/Simulink/Matalb Function. However, when i run the simulation, the errors occurred.(please see the attached picture and code). If possible, please help me. Thank you very much for your help.
function gamma = cg(gamma0,voutx,tao,e1,e2,M)
beta1=gamma0(1);
beta2=gamma0(2);
beta3=gamma0(3);
beta4=gamma0(4);
beta5=gamma0(5);%gamma0 is a vector.
xd=20;%设定位置x
T=0.01;%积分步长
falf=fal(tao,0.5,0.1);
fal1=dfal(e1,0.7,0.1);
fal2=dfal(e2,0.95,0.1);
b0=1;
k=1;
N=100000;%times maximum
epsilon=1e-5;%parameter
gamma=gamma0;
while(k<N)
g=gradient(xd,voutx,fal1,fal2,falf,T,b0,M,gamma);%gradient
beta1=beta1-2*(xd-voutx)*M*(beta4*fal1*T*tao)/(1+(beta4*fal1*T+beta5*fal2)*T*b0);
beta2=beta2-2*(xd-voutx)*M*T*falf*(beta4*fal1*T+beta5*fal2)/(1+(beta4*fal1*T+beta5*fal2)*T*b0);
beta3=beta3-2*(xd-voutx)*M*((beta4*fal1*T+beta5*fal2)*T*T+T/b0)*falf/(1+(beta4*fal1*T+beta5*fal2)*T*b0);
beta4=beta4-2*(xd-voutx)*M*fal1/(1+(beta4*fal1*T+beta5*fal2)*T*b0);
beta5=beta5-2*(xd-voutx)*M*fal2/(1+(beta4*fal1*T+beta5*fal2)*T*b0);%the three parameters that need to be adjusted
gamma=[beta1;beta2;beta3;beta4;beta5];%vector
if(norm(g)<epsilon), break; end
end
  19 Comments
Fangjun Jiang
Fangjun Jiang on 25 Jul 2022
This is probably where the help from this community ends. The simulation of the Simulink model runs but it is extremely slow and it stopped due to instability of the simulation. You need to consult the expert in your field to resolve the problem. Most likely the parameters of the ADRC is too aggressive. Avoid directly derivative.
Joe Jones
Joe Jones on 26 Jul 2022
Dear
Thank you for your time and effort you have put into my problems. Your help is of great significance for me to solve the problem. I will continue to do my best to resolve these errors. Thank you again!@Fangjun Jiang
Wish you every success!

Sign in to comment.

Answers (0)

Categories

Find more on Simulink Functions 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!