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!