I want to ask how to define the partial fraction code single number located at the numerator?

1 回表示 (過去 30 日間)
>> syms s
>> F=4(3*s+13)/(8*s^2+s+4)
F=4(3*s+13)/(8*s^2+s+4)
Invalid expression. When calling a function or indexing a variable, use parentheses.
Otherwise, check for mismatched delimiters.

回答 (2 件)

Arif Hoq
Arif Hoq 2023 年 1 月 28 日
移動済み: John D'Errico 2023 年 1 月 28 日
use multiplication operator (*) before parentheses
syms s
F=4*(3*s+13)/(8*s^2+s+4)
F = 

John D'Errico
John D'Errico 2023 年 1 月 28 日
編集済み: John D'Errico 2023 年 1 月 28 日
Remember that MATLAB does not understand implicit multiplication. That is, 4x is not interpreted as 4*x. In MATLAB, 4x is just a syntax error. (With the subtle and singular exception that things like 1i are interpreted by the parser as 1*sqrt(-1).)
What did MATLAB tell you? That MATLAB had a problem where the little arrow points. And you already knew to use 8*s^2, to form that product in another place, so you do apparently understand the need for an * operator.
This works of course:
syms s
F=4*(3*s+13)/(8*s^2+s+4)
F = 
Error messages usually try to point out where a problem lies. In this case, MATLAB was confused. It saw this:
4(3*s+13)
and said, ok, 4 must be a function, and 3*s+13 is the argument to that function. Wait, a number cannot be the name of a function. So then 4 must be a variable, since parens are also used to index into a variable. But then 4 is not the name of a variable either. As that point, MATLAB just gave up and threw an error.
Computers are easily confused.

カテゴリ

Help Center および File ExchangeConversion Between Symbolic and Numeric についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by