HELP: 'Error: Function definitions are not permitted in this context.'
Afficher commentaires plus anciens
I'm new to matlab just for you to know.
I'm getting this error on this function:|
function [dydt]=deriv(t,y,a,b,u,df,dr,Fn)
dydt=zeros(2,1);
alphaf=(y(2)+a*y(1))/u-df; % Slip Angle Front [rad]
alphar=(y(2)-b*y(1))/u-dr; % Slip Angle Rear [rad]
tire_model(niu,Calpha,alphaf,alphar,Fn) % Lateral Forces [N]
dydt(1)= (1/Izz)*(Fyf*a-Fyr*b); % Yaw Acelaration
dydt(2)= (1/M)*(Fyf+Fyr)-u*y(1); % Lateral Acelaration
end
a,b,u,df,dr,Fn are defined in the main script, I noticed that if I define them inside this function it works, but that's not what I pretend.
Thanks in advance
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Numerical Integration and Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!