Borrar filtros
Borrar filtros

couldn't understand what's wrong in the function definition.

1 visualización (últimos 30 días)
f = @(t,y) [
((y(2)-a-l.*(abs(cos(y(3)+ pi/4)))).*y(1) + k.*y(1).*cos(y(3)- pi/2)).*(2/tc);
(P - (y(2).*(y(1) + 1))) / tf;
o - (k./tc).*2.* sin(y(3)));
];
getting a problem
"Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for
mismatched delimiters." in this.

Respuesta aceptada

Walter Roberson
Walter Roberson el 19 de Jul. de 2022
o - (k./tc).*2.* sin(y(3)));
1 0 1 2 10!
the digits are the nesting level "after" the character above. You open and then close brackets, leaving zero open brackets. You then open two brackets... and you close three brackets, one more than you opened.

Más respuestas (1)

Chunru
Chunru el 19 de Jul. de 2022
a =1; P=2; i=3; tf=4; k=5; l=6; tc=7; o=8;
f = @(t,y) [ ( (y(2)-a-l.*(abs(cos(y(3)+ pi/4)) )).*y(1) + k.*y(1).*cos(y(3)- pi/2)).*(2/tc);
(P - (y(2).*(y(1) + 1))) / tf;
o - (k./tc).*2.* sin(y(3)) ]
f = function_handle with value:
@(t,y)[((y(2)-a-l.*(abs(cos(y(3)+pi/4)))).*y(1)+k.*y(1).*cos(y(3)-pi/2)).*(2/tc);(P-(y(2).*(y(1)+1)))/tf;o-(k./tc).*2.*sin(y(3))]
f(1, [1; 2; 2])
ans = 3×1
-0.0220 -0.5000 6.7010

Categorías

Más información sobre Read, Write, and Modify Image en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by