# How to create a symbolic general (without explicit definition) function?

조회 수: 7 (최근 30일)
Yunshen Huang . 2021년 3월 10일
댓글: Yunshen Huang . 2021년 3월 14일
Hi all,
I want to know how to create a general function in symbolic way. My goal is to examine the differentials of the overall function in terms of a variable, where there are some functions of this variable that I am not interested in. I checked some documents, all ask me to explicitly define those functions.
Here is a example I am thinking of, which is realized in the psudo code:
syms x g real
f = x*g(x);
fdx = simplify(diff(f,x))
where g is the general function that I want to create. Therefore, this code is supposed to give me the result like:
fdx = g(x)+x*ddxg(x)
Since I really don't care the expression of g(x), a representation like ddxg(x) is what I want in the result.

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

### 채택된 답변

Prudhvi Peddagoni 2021년 3월 12일
Hi,
You need to specify that g is a function of x like this:
syms x g(x)
f = x*g;
fdx = diff(f,x);
Hope this helps.
##### 댓글 수: 1표시 없음숨기기 없음
Yunshen Huang 2021년 3월 14일
Thanks! it works exactly as I want

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

### 카테고리

Help CenterFile Exchange에서 Assumptions에 대해 자세히 알아보기

R2019a

### Community Treasure Hunt

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

Start Hunting!

Translated by