フィルターのクリア

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

1 回表示 (過去 30 日間)
SAHIL SAHOO
SAHIL SAHOO 2022 年 7 月 19 日
回答済み: Walter Roberson 2022 年 7 月 19 日
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.

採用された回答

Walter Roberson
Walter Roberson 2022 年 7 月 19 日
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.

その他の回答 (1 件)

Chunru
Chunru 2022 年 7 月 19 日
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

カテゴリ

Help Center および File ExchangeRead, Write, and Modify Image についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by