I want to ask how to define the partial fraction code single number located at the numerator?
1 view (last 30 days)
Show older comments
>> 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.
0 Comments
Answers (2)
Arif Hoq
on 28 Jan 2023
Moved: John D'Errico
on 28 Jan 2023
use multiplication operator (*) before parentheses
syms s
F=4*(3*s+13)/(8*s^2+s+4)
0 Comments
John D'Errico
on 28 Jan 2023
Edited: John D'Errico
on 28 Jan 2023
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)
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.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!