필터 지우기
필터 지우기

Error using / Arguments must be numeric, char, or logical. what should I do I tried but did not seem to work?

조회 수: 12 (최근 30일)
>> m=2+0
m =
2
>> n=2+5
n =
7
>> syms x
>> f=inline(2*x^2-(3*m-n)*x-m*n)/(x^2+(m-n)*x-n*m)
Error using /
Arguments must be numeric, char, or logical.

답변 (2개)

Chandler Hall
Chandler Hall 2022년 11월 13일
편집: Chandler Hall 2022년 11월 13일
To create a symbolic function, you must first declare it via the syms function, and then define its content. The syntax for this is straightforward but atypical:
m = 2; n = 7;
syms f(x)
f(x) = (2*x^2-(3*m-n)*x-m*n)/(x^2+(m-n)*x-n*m);
  댓글 수: 1
Walter Roberson
Walter Roberson 2022년 11월 13일
This is not correct. You can create a symbolic function in three different ways:
syms Name(Variable list)
Name(Variable list) = symbolic expression
Name = symfun(symbolic expression, Variable list)
The syms form has the side effect of defining the variables, but is not required before either of the other approaches.

댓글을 달려면 로그인하십시오.


Walter Roberson
Walter Roberson 2022년 11월 13일
Never inline() a symbolic expression, it is not defined. matlabFunction() instead.
Never eval() a symbolic expression either, use subs()

카테고리

Help CenterFile Exchange에서 Numbers and Precision에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by