Vector error
3 views (last 30 days)
Show older comments
Hi,
I keep getting an error when I change a parameter at a certain time in my simulation of an aircraft braking. I am using an s-block which performs my integration and outputs the velocity and displacment of the aircraft as a real vector with two outputs.
However when I change the friction co-eff. ur from 0.026 to 0.528 i get this error:
State derivatives returned by S-function 'spoilers' in 'scott/Deceleration' during flag=1 call must be a real vector of length 2.
My program is as follows:
%Rolling friction (to change when brakes are applied) ur=0.026; if t>0.3 ur=0.528; end
%Drag co-efficient (possibly read from table) cd=0.0641; cl=0.749; if t>0.7 cd=0.0978; cl=0.536; end
%GI selected, one engine in operation: a=85; b=7.241; c=1.367; d=0.0078;
%Aerodynamic and friction loading e=(0.5*p*S*(cd-(cl*ur))); f=-(ur*W);
% Equations to be integrated xdot (1)=((a+f)+(b*x(1))+((-c-e)*(x(1)^2))+(d*(x(1)^3)))/m; xdot (2)=x(1);
% Perform integration. vdot=xdot (1); sdot=xdot (2);
sys = [vdot; sdot;];
Does changing from 0.026 to 0.528 drastically affect the equation xdot (1) to the point where it cannot return a real vector?
Any help is welcome.
Accepted Answer
Jan
on 8 Mar 2011
Is "sys" the output of you function? Then simply display the values of "sys" before the function is left to find out, why Matlab thinks, it is not a vector of 2 real elements.
0 Comments
More Answers (1)
Gustavo Mattos
on 22 Jun 2015
It happened to me when I was dealing with an unstable system (sys -> Inf).
0 Comments
See Also
Categories
Find more on Automotive Applications in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!