Error that X is used but not initalized.

조회 수: 5 (최근 30일)
Zayin Jarrez
Zayin Jarrez 2024년 3월 4일
답변: Sibghat 2024년 3월 4일
My super simply Live script code
"
syms I
O(I)=14.6*10^(-3)*I
"
Output:
Warning: Uninitialized variable 'x' is used.
Bruh, i dont have an X in sight..... Maple>>matlab

답변 (2개)

VBBV
VBBV 2024년 3월 4일
syms I
O = 14.6*10^(-3)*I % define this way
O = 
O(I) = 14.6*10^(-3)*I
Warning: Uninitialized variable 'x' is used.
O(I) = 
  댓글 수: 1
VBBV
VBBV 2024년 3월 4일
Possibly due to assigning symoblic variables as function of implicitly defined variables

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


Sibghat
Sibghat 2024년 3월 4일
One possible explanation to the error message could be that MATLAB is interpreting 'I' as 'x'. You don't need to define O(I) as you would in a symbolic math toolbox. Instead, you can define O as a function of I.
syms I
O(I) = 14.6 * 10^(-3) * I
Warning: Uninitialized variable 'x' is used.
O(I) = 
O = 14.6 * 10^(-3) * I
O = 
PS: I read somewhere that MATLAB interprets undefined variable as 'x' by default in symbolic expressions. So, perhaps when you're defining O(I), MATLAB interprets it as O(x). However, I'd need to confirm that to be certain...

카테고리

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

태그

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by