matlab function block in Simulink
2 views (last 30 days)
Show older comments
Hello,
I dont understand whats going on in my matlab function block.
I have the following Code
function y = Lenkwinkelbegrenzung3(Fx_V, Fy_V, Mz_V, F_max_1, F_max_2, F_max_3, F_max_4, f1,f2,F_Fehler_1,F_Fehler_2, f3, f4, F_Fehler_3, F_Fehler_4, l_h, l_v, w_vl, w_hl, w_hr, w_vr)
E = [1,0,1,0,1,0,1,0;
0,1,0,1,0,1,0,1;
-w_vl,l_v,w_vr,l_v,-w_hl,-l_h,w_hr,-l_h;
1,0,0,0,0,0,0,0];
F_soll = [Fx_V; Fy_V; Mz_V; 0];
%Definition des Rechtsannihilators G_ra
E_Ra = null(E);
%Definition der Moore-Penrose Inverse G_plus
E_Moore = transpose(E)/(E*transpose(E));
%Definition der Gewichtungsmatrix Q
Q = [1/F_max_1 0 0 0 0 0 0 0;
0 1/F_max_1 0 0 0 0 0 0;
0 0 1/F_max_2 0 0 0 0 0;
0 0 0 1/F_max_2 0 0 0 0;
0 0 0 0 1/F_max_3 0 0 0;
0 0 0 0 0 1/F_max_3 0 0;
0 0 0 0 0 0 1/F_max_4 0;
0 0 0 0 0 0 0 1/F_max_4];
delta_U = -inv(transpose(E_Ra)*Q*E_Ra)*transpose(E_Ra)*Q*E_Moore*F_soll;
y= E_Moore*F_soll+E_Ra*delta_U;
An in my matlab skript I get a reasonable output with y(1) = 0,
but as soon as I implement it in a matlab function block in simulink my y(1) doesnt equal zero anymore.
Can anyone explain to me why?
I dont understand why this is happening and what can I do about it
Thanks for reading
0 Comments
Answers (0)
See Also
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!