How can I define parameters and set them equal to each other dynamically?

조회 수: 4 (최근 30일)
Aaron Zheng
Aaron Zheng 2021년 9월 23일
답변: 埃博拉酱 2024년 10월 28일
For a high school essay, I have the following problem. I have a set of 24 parameters(defined by the command syms) which take positive real values, and a list of 19 independent algebraic equations that relate to each of those parameters. For the sake of convenience, lets assume my parameters are can be expressed with set {a_n, where 1<=n<=24 }
What I want to determine is the maximum amount of the parameters {a_n} that can have equal value, such that the set of parameters still satisfy the 19 equations. As a result, I need to be able to set every possible permutation of k parameters equal to each other.
Currently, the method I'm brainstorming is to define a vector that contains the set, such as this:
vec = [a, b, c, d, e, f, g, h, i1, j1, k, l, m, z, o, p, q, r, s, t, u,v,w,x,y];
and then use the nchoosek function on the set vec to choose all possible permutations of some size, say size. Then, I loop through all permutations, and manually define size-1 new equations defining two variables as equal to each other.
Then, I plug in the original 19 equations, as well as the size-1 new equations into a solve function to get my answer.
Is there an easier way to set parameters equal to each other?

답변 (1개)

埃博拉酱
埃博拉酱 2024년 10월 28일
If your equations are all linear, try using some linear algebra methods, such as rank.

카테고리

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

태그

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by