why the error is written here (Not enough input arguments.)
조회 수: 1 (최근 30일)
이전 댓글 표시
function dydt= project(t,psi)
M=5; m=0.5; R=0.5; tau=10*sin(100*t); F=10*cos(10*t) ; ddx=2;
dydt(1)=y(3);
dydt(2)=y(4);
dydt(3)=-(M*R^2*y(3) - 2*tau + 2*R^2*y(3)*m + 2*R*ddx*sin(y(1)))/(2*R*cos(y(1)))
dydt(4)=(M^2*R^2*y(3) + 3*M*R^2*y(3)*m + 2*ddx*sin(y(1))*M*R - 2*tau*M + 2*cos(y(1))*sin(y(1))*R^2*y(3)^2 + 2*R^2*y(3)*m^2 + 2*ddx*sin(y(1))*R*m + 2*F*cos(y(1))*R - 2*tau*m)/(2*R^2*cos(y(1))^2)
dydt=dydt';
end
댓글 수: 0
채택된 답변
madhan ravi
2018년 12월 16일
편집: madhan ravi
2018년 12월 16일
[t,y]=ode45(@project,[0 10],[0;0;0;0]) ; % you forgot to call the function with input arguments
plot(t,y(:,1))
figure
plot(t,y(:,2),'r')
figure
plot(t,y(:,3),'g')
figure
plot(t,y(:,4),'m')
function dydt= project(t,y) % function definition
M=5; m=0.5; R=0.5; tau=10*sin(100*t); F=10*cos(10*t) ; ddx=2;
dydt=zeros(4,1);
dydt(1)=y(3);
dydt(2)=y(4);
dydt(3)=-(M*R^2*y(3) - 2*tau + 2*R^2*y(3)*m + 2*R*ddx*sin(y(1)))/(2*R*cos(y(1)));
dydt(4)=(M^2*R^2*y(3) + 3*M*R^2*y(3)*m + 2*ddx*sin(y(1))*M*R - 2*tau*M + 2*cos(y(1))*sin(y(1))*R^2*y(3)^2 + 2*R^2*y(3)*m^2 + 2*ddx*sin(y(1))*R*m + 2*F*cos(y(1))*R - 2*tau*m)/(2*R^2*cos(y(1))^2);
end
댓글 수: 9
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!