Why do I get this error message: Undefined function or variable 'equationsToMatrix'.

조회 수: 2 (최근 30일)
Hello everyone,
I have written a code on a desktop at my University and I ran it and it worked. However, when I saved and ran the exact same code on my laptop it returns with the following error message:
Undefined function or variable 'equationsToMatrix'.
Error in Eq_Solver (line 54)
[AA,BB] = equationsToMatrix([eq1, eq2, eq3, eq4],[A1, B1, A2, B2])
I searched about it and I saw some people in the community mentioning that this may be because of not having Symbolic Math Toolbox installed. When I checked the addons explorer, I found the Symbolic Math Toolbox installed, however when I typed "ver" in the command window I did not see Symbolic Math Toolbox installed.
MATLAB Version 9.5 (R2018b)
Simulink Version 9.2 (R2018b)
Control System Toolbox Version 10.5 (R2018b)
DSP System Toolbox Version 9.7 (R2018b)
Data Acquisition Toolbox Version 3.14 (R2018b)
Image Processing Toolbox Version 10.3 (R2018b)
Instrument Control Toolbox Version 3.14 (R2018b)
Optimization Toolbox Version 8.2 (R2018b)
Signal Processing Toolbox Version 8.1 (R2018b)
Simulink Control Design Version 5.2 (R2018b)
Statistics and Machine Learning Toolbox Version 11.4 (R2018b)
The code:
syms t
syms A1 B1 A2 B2
Omega = 200;
M11 = 5.0;
M12 = 0;
M21 = 0;
M22 = 1.0;
C11 = 3;
C12 = -1;
C21 = -1;
C22 = 1;
K11 = 400;
K12 = -150;
K21 = K12;
K22 = 150;
M = [M11 M12; M21 M22];
C = [C11 C12; C21 C22];
K = [K11 K12; K21 K22];
F1 = 2*Omega^2;
F2 = 0.1*Omega^2;
F = [F1*sin(Omega*t); F2*cos(Omega*t)];
eq1 = K11*(B1) + K12*(B2) - M11*(B1*Omega^2) - M12*(B2*Omega^2) + C11*(A1*Omega) + C12*(A2*Omega) == 0;
eq2 = K11*(A1) + K12*(A2) - M11*(A1*Omega^2) - M12*(A2*Omega^2) + C11*(-B1*Omega) + C12*(-B2*Omega) == F1;
eq3 = K21*(B1) + K22*(B2) - M21*(B1*Omega^2) - M22*(B2*Omega^2) + C21*(A1*Omega) + C22*(A2*Omega) == F2;
eq4 = K21*(A1) + K22*(A2) - M21*(A1*Omega^2) - M22*(A2*Omega^2) + C21*(-B1*Omega) + C22*(-B2*Omega) == 0;
[AA,BB] = equationsToMatrix([eq1, eq2, eq3, eq4],[A1, B1, A2, B2]);
I feel kind of lost on what I should do now!
Thanks in advance!
  댓글 수: 3
Zeyad Elsayed
Zeyad Elsayed 2019년 7월 20일
I included the code in the original question.
Walter Roberson
Walter Roberson 2019년 7월 20일
I would suggest using the installer to reinstall the symbolic toolbox

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by