Need help for Error happened during using SIMULINK HDL coder
Mostrar comentarios más antiguos
I have next code , and related SIMULINK model , want to convert to VHDL code , using SIMULINK HDL coder , but error happened :
clear clf
I1=1989;I2=1876;I3=407;h=53.66;m1=257.419;m2=154.062;b3=6.86157e-8;n=.0042; a=[0 0 1 0;0 0 0 1;-h*n/I1 0 0 -h/I1;0 -n*h/I2 h/I2 0]; %a =[0 0 1 0;0 0 0 1;-0.0017 0 0 -0.0270;0 -0.0018 0.0286 0]; b=[0;0;m2*b3/I1;m1*b3/I2]; %b = 1.0e-008 *[0;0;0.5315;0.9415]; c=[1.0e-7 1.0e-6 8.0e-4 1.0e-3]; %roots=-4.3741+--89.274i,-1.2517 g=22; % g < 1/4*max eigen tf=43200; [Ad,Bd]=c2d(a,b,g);
% desired output lamda=1.0e-7 ; a4=1.0e-3 ; a3=1.0e-4; a2=1.0e-6 ; xd=0 ; q=50 ; k=10 ; x=[.5;0;0;.007]; t=0; u=0 ; i=1 ;
while t<tf x1=x(1);x2=x(2);x3=x(3);x4=x(4); xx1(i)=x1;xx2(i)=x2; xx3(i)=x3;xx4(i)=x4;uu(i)=u;t1(i)=t; s =a4*x4+a3*x3+a2*x2+lamda*(x1-xd); % switching surface I4 = [1 0 0 0;0 1 0 0;0 0 1 0;0 0 0 1]; u =-c*(a+q*I4/abs(c*x)+k*I4)*x -k*s ; x = Ad*x+Bd*u ; i=i+1; t=t+g; end subplot(2,2,1), plot(t1,xx1);grid;title('Roll Response'); subplot(2,2,2), plot(t1,uu);grid; title('U input Response'); subplot(2,2,3), plot(t1,xx4);grid; title('Yaw Response'); subplot(2,2,4), plot(t1,xx3);grid; title('Yaw Rate Response');
best regards
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre HDL Coder en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!