Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Simulink model of system

조회 수: 2 (최근 30일)
Mohsina Zafar
Mohsina Zafar 2019년 3월 18일
마감: MATLAB Answer Bot 2021년 8월 20일
Hello,
I have a system that I coded in Matlab .m file. As I have to extend it further into a complex control loop, I wish to convert it into simulink model.
But the plot of simulink model is not coming out to be the same as the code plot. Kindly check what the problem might be.
Simulink file is attached.
.m Code:
[t,x] = ode45(@EOM,[0 10],[0;pi/2]);
plot(t,x(:,1),'-',t,x(:,2),'-')
xlabel('Time t');
ylabel('Solution x');
legend('x_1','x_2')
function [dxdt] =EOM(t,x)
g=9.8 ; l=0.3 ; m1=4 ;
u=20*exp(-t*0.2).*cos(2*pi*t);
dxdt = [x(2); -(g/l)*cos(x(1))+u/(m1*l^2)];
end

답변 (0개)

이 질문은 마감되었습니다.

제품


릴리스

R2015a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by