Simulink numerical error?

Hi,
I am using simulink to control a robotic arm.
I am facing a strange problem. When I am running the simulation, there are 2 values which should be equivalent (their expressions are same). When I simout those 2 variables, their errors are in the order for e-4, which my system can't accept.
But when I run the same corresponding code in matlab (.m file), errors are in the order of e-18 or exactly 0.
What does this mean? Should I develop my control system in matlab file itself?
Will attach those 2 files if required.
Thanks in advance.

댓글 수: 2

Kaustubha Govind
Kaustubha Govind 2011년 6월 17일
How are these expressions computed in Simulink (Simulink library blocks, Embedded MATLAB Block, Stateflow, etc.)? If using blocks, do you use the exact same blocks in both code-paths? What are the datatypes of your signals?
Shobhit Gupta
Shobhit Gupta 2011년 6월 18일
Hey Kaustubha,
I am attaching my matlab files. You can check the values of Glin and G both in simulink (I've simout both variables in workspace) and the code as well.
Basically, they are same mathematical expression written in different ways. So ideally, their value should be same for same parameters i.e. mass(m), length(l) and angles (X(1),X(2),X(3)).
http://www.4shared.com/file/IVDqiMMy/Control_lislotine_norob_damp_1.html?
[control_lislotine_norob_damp_17jun_lin_compare.mdl is my control system in simulink.]
http://www.4shared.com/file/NrQa0OId/y_dynamics_check.html?
[While y_dynamics_check is the matlab file which calculates value of Glin and G in simulink for a series of angles]
http://www.4shared.com/file/FnPbK4I_/Y_check.html?
[Same as previous, but just checks it for one angle value].
Thanks in advance

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Simulation에 대해 자세히 알아보기

질문:

2011년 6월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by