필터 지우기
필터 지우기

How does the MATLAB symvar function work?

조회 수: 2 (최근 30일)
ABTJ
ABTJ 2019년 5월 14일
답변: Walter Roberson 2019년 5월 14일
I read the documentation and help about the symvar function but I'm still confused about how it works, especially for the following example:
clc
clear all
syms x y a
symvar(x + y, 1)
When I run this M-file, I get the answer 'x'. Why am I getting this answer? Why not 'y'? And what is the role of the number 1 written as the second argument?

채택된 답변

Walter Roberson
Walter Roberson 2019년 5월 14일
"symvar(s,n) chooses the n symbolic variables in s that are alphabetically closest to x and returns them in alphabetical order."
You get 1 because you asked for only 1.
You get x because it is alphabetically closer to x than y is

추가 답변 (0개)

카테고리

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

제품


릴리스

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by