what is the problem in thecode??
Mostrar comentarios más antiguos
global k m1 m2 q1 q2 rw iT;
k=8500; %Stiffness of snatch strap m1=1830; %Mass of bogged car in kg m2=2650; %Mass of 4WD in kg q1=925*(x(2)^2);%bogged car drag in N q2=140*(x(4)^2);%4WD drag in N rw=0.394; %Wheel radius in m iT=15; %Gearbox ratio
t0=0; %Define the starting time of the motion in second tf=20; %Define the ending time of the motion in second x0= [0; 0; 0; 0]; %Define the displacement and velocity of bogged car and 4WD Tf=(Te*iT*4)/(rw*4); %Equation to find total wheel force of 4WD car qT=+q2+BF; %Equation of total drag force
options=odeset('abstol',le-6, 'reltol',le-6); %Define the relative and absolute tolerance [t,x]=ode45('Motion_Function',[t0,tf],x0,options);
figure(1); %Plot a graph in a new window plot(t,x(:,1), 'b',t,x(:,3), 'r'); xlabel('Time (s)'); ylabel('Displacement (m)'); title('Graph of Displacement versus Time'); legend('Displacement of bogged car', 'Displacement of 4WD'); grid on; %Plot the graph of displacement versus time for bogged car and 4WD
figure(2); %Plot a graph in a new window plot(t,x(:,2), 'b',t,x(:,4), 'r'); xlabel('Time (s)'); ylabel('Velocity (m)'); title('Graph of Velocity versus Time'); legend('Velocity of bogged car', 'Velocity of 4WD'); grid on; %Plot the graph of Velocity versus time for bogged car and 4WD Undefined function or variable 'x'
2 comentarios
madhan ravi
el 3 de Oct. de 2018
Editada: madhan ravi
el 3 de Oct. de 2018
Select the whole code and press the code button {} also upload Motion_Function.
Chin Kong
el 3 de Oct. de 2018
Respuestas (1)
madhan ravi
el 3 de Oct. de 2018
Editada: madhan ravi
el 3 de Oct. de 2018
[t,x]=ode45(@Motion_Function,[t0,tf],x0,options);
Use
@Motion_Function
Instead of string
'Motion_Function'
4 comentarios
Chin Kong
el 3 de Oct. de 2018
madhan ravi
el 3 de Oct. de 2018
Select the whole code and press the code button your code is not readable
Chin Kong
el 3 de Oct. de 2018
Chin Kong
el 3 de Oct. de 2018
Categorías
Más información sobre Assembly en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!