what is the problem in thecode??
이전 댓글 표시
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
madhan ravi
2018년 10월 3일
편집: madhan ravi
2018년 10월 3일
Select the whole code and press the code button {} also upload Motion_Function.
Chin Kong
2018년 10월 3일
답변 (1개)
madhan ravi
2018년 10월 3일
편집: madhan ravi
2018년 10월 3일
[t,x]=ode45(@Motion_Function,[t0,tf],x0,options);
Use
@Motion_Function
Instead of string
'Motion_Function'
댓글 수: 4
Chin Kong
2018년 10월 3일
madhan ravi
2018년 10월 3일
Select the whole code and press the code button your code is not readable
Chin Kong
2018년 10월 3일
Chin Kong
2018년 10월 3일
카테고리
도움말 센터 및 File Exchange에서 Assembly에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!