필터 지우기
필터 지우기

code for check wether the given differential function is function g(x) or g(x,y) in matlab

조회 수: 3 (최근 30일)
how to check wether the given differential function is function g(x) or g(x,y) in matlab
maybe i am doing mistake
clear
clc
syms x y
a=input('f(x,y)=')
f=inline(a,'x','y')
g=inline(diff(f(x,y),x))
if g==f(x)
k=g(1)
elseif g==f(x,y)
k=(1,2)
end

채택된 답변

John D'Errico
John D'Errico 2024년 4월 6일
편집: John D'Errico 2024년 4월 6일
Easy. For example...
syms x y
expr1 = 2*x;
expr2 = x + x*y;
Now use symvar.
symvar(expr1)
ans = 
x
numel(symvar(expr1))
ans = 1
symvar(expr2)
ans = 
numel(symvar(expr2))
ans = 2
So expr2 is a function of two symbolic variables.

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by