error when use 'x' created by syms method: 输入参数的数目不足。 出错 digits (第 15 行) f = func; 出错 sym/display (第 12 行) if ~isempty(useDigits) && useDigits ~= digits()

조회 수: 3 (최근 30일)
Boheng Zhao
Boheng Zhao 2023년 12월 2일
편집: Dyuman Joshi 2023년 12월 29일
When enter the code like:
syms x
then:
equ = 2*x==9
It is pop a error:
输入参数的数目不足。(Insufficient number of input parameters)
出错 digits (第 15 行) (error digits (line 15))
f = func;
出错 sym/display (第 12 行) (error sym/display (line 12))
if ~isempty(useDigits) && useDigits ~= digits()
When I write above code with colon (;), there is no error but the result is not what I want to.
In each case it will plot an empty figure for me which is confused. In other machine it will work appropriately, but I failed after update and reinstall my matlab and toolbox and reboot the computer.
  댓글 수: 4
Boheng Zhao
Boheng Zhao 2023년 12월 2일
Accually when I run any example of solve method given by matlab official document it cannot run and giving a such error, not like the result given by the document shown. When I add colon for equ = 2*x==9;, it will have no error and equ is 1*1sym. However, when click into it, there is a empty plot which can not close and have a comment: unable to reference the variable. It is wired.
Dyuman Joshi
Dyuman Joshi 2023년 12월 29일
편집: Dyuman Joshi 2023년 12월 29일
@Boheng Zhao, Run this command and see if the code works afterwords -
restoredefaultpath;
rehash toolboxcache;

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

답변 (1개)

SAI SRUJAN
SAI SRUJAN 2023년 12월 28일
Hi Boheng,
I understand that you are facing an error with the symbolic toolbox.
It looks like you're encountering an issue with MATLAB's symbolic toolbox, specifically when trying to define and display a symbolic equation. The error suggests there might be a problem with your MATLAB installation or with the symbolic toolbox itself, especially since you mention that the code works on another machine.The error messages seem to be pointing to an issue with the 'digits' function, which is related to variable-precision arithmetic and not directly related to defining symbolic variables or equations.
Ensure that there are no user-defined functions or scripts in your MATLAB path that might be overriding the built-in 'digits' or 'display' functions. You can check this by running:
which digits -all
which display -all
It is recommended to update MATLAB to the latest version and restart the software, as this may resolve any potential conflicts or compatibility issues. If the problem persists, reinstalling the Symbolic Math Toolbox might be necessary to ensure all necessary files and dependencies are properly installed.
Please use the following commands to check the proper installation of Symbolic Math Toolbox,
which sym
For a comprehensive understanding of the 'which' command in MATLAB, please refer to the following documentation.
I hope this helps.

카테고리

Help CenterFile Exchange에서 Assumptions에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!