como ultrapassar esse erro

syms x
int (cos(x),x,-pi/2,pi/2);
Error using sym/subsindex
Invalid indexing or function definition. Indexing must follow MATLAB indexing. Function arguments must be symbolic variables, and function
body must be sym expression.
Error in indexing (line 1079)
R_tilde = builtin('subsref',L_tilde,Idx);

6 件のコメント

Dyuman Joshi
Dyuman Joshi 2023 年 4 月 2 日
It's working properly
syms x
int(cos(x),x,-pi/2,pi/2)
ans = 
2
Is this your whole code?
Cris LaPierre
Cris LaPierre 2023 年 4 月 2 日
Que version de MATLAB estas usando?
No hay errores en R2023a.
syms x
int(cos(x),x,-pi/2,pi/2)
ans = 
2
Por favor, comparte todo el mensaje del error (todo el texto rojo), y todo el codigo que estas ejecutando.
Adalberto
Adalberto 2023 年 4 月 2 日
estou a usar a versão R2022b
pretendo calcular a integral dupla da função cos^n(x) dydx neste intervalo -pi/2 a pi/2.
syms x
int (cos(x),x,-pi/2,pi/2);
Error using sym/subsindex
Invalid indexing or function definition. Indexing must follow MATLAB indexing. Function arguments must be symbolic variables, and function
body must be sym expression.
Error in indexing (line 1079)
R_tilde = builtin('subsref',L_tilde,Idx);
Related documentation
>> syms x
int (cos(x)^n,x,-pi/2,pi/2);
Error using sym/subsindex
Invalid indexing or function definition. Indexing must follow MATLAB indexing. Function arguments must be symbolic variables, and
function body must be sym expression.
Error in indexing (line 1079)
R_tilde = builtin('subsref',L_tilde,Idx);
Related documentation
>> syms x
int (cos(x)^2,x,-pi/2,pi/2);
Error using sym/subsindex
Invalid indexing or function definition. Indexing must follow MATLAB indexing. Function arguments must be symbolic variables, and
function body must be sym expression.
Error in indexing (line 1079)
R_tilde = builtin('subsref',L_tilde,Idx);
Related documentation
>>
Dyuman Joshi
Dyuman Joshi 2023 年 4 月 2 日
編集済み: Dyuman Joshi 2023 年 4 月 2 日
he usado el traductor de google
"pretendo calcular a integral dupla da função cos^n(x) dydx neste intervalo -pi/2 a pi/2."
Pero no hay y en esta ecuación.
Está funcionando bien aquí en 2023a. También verifiqué en 2021 y funcionó sin ningún error.
syms x n
out1=int(cos(x),x,-pi/2,pi/2)
out1 = 
2
out2=int(cos(x)^2,x,-pi/2,pi/2)
out2 = 
outn=int(cos(x)^n,x,-pi/2,pi/2)
outn = 
Cris LaPierre
Cris LaPierre 2023 年 4 月 2 日
編集済み: Cris LaPierre 2023 年 4 月 2 日
Ejecuta el siguiente codigo y avisanos el resultado
which syms
which int
ver
Ha instalado el Symbolic Math Toolbox? Si no, y esta incluido en su licencia, lo puede instalar usando Add-Ons Explorer
Dyuman Joshi
Dyuman Joshi 2023 年 4 月 2 日
Cris, if the Symbolic Math Toolbox is not installed then it would give the following error - 'Undefined function 'syms' for input arguments of type 'char' after the first line/.

サインインしてコメントする。

回答 (1 件)

Cris LaPierre
Cris LaPierre 2023 年 4 月 2 日

1 投票

Parece que haya creado un variable llamado int.
% Para recrear el error (el mensaje es un poco diferente en R2023a
int=5;
syms x
int (cos(x),x,-pi/2,pi/2);
Error using indexing
Invalid indexing or function definition. Indexing must follow MATLAB indexing. Function arguments must be symbolic variables, and function body must be sym expression.
En R2022b, el mensaje es
Error using sym/subsindex
Invalid indexing or function definition. Indexing must follow MATLAB indexing. Function arguments must be symbolic variables, and function body
must be sym expression.
Hay que vaciar el variable int
clear int
syms x
int(cos(x),x,-pi/2,pi/2)

1 件のコメント

Adalberto
Adalberto 2023 年 4 月 2 日
ok.
muito obrigado Cris, já fiz um release na versão, agora estou a instalar o symbolic toolbox. para testar.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

質問済み:

2023 年 4 月 2 日

コメント済み:

2023 年 4 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by