How does the MATLAB symvar function work?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
ABTJ
am 14 Mai 2019
Beantwortet: Walter Roberson
am 14 Mai 2019
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?
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 14 Mai 2019
"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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Numbers and Precision finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!