Problem with symbolic variables system

조회 수: 1 (최근 30일)
xrysa
xrysa 2014년 3월 17일
편집: Walter Roberson 2014년 3월 17일
I am confused with symbolic variables and function of a variable.
I have a Y which is a function of D. In fact Y is a vector of size N and each and each Yi=function(D).
I also have a X which is a function of Y. That is Xi=function(Yi) so in the end also X will be a function of D.
Then I have an A=sum(Y*X).
What I need to do is to solve a system of nonlinear equations of dA==0 where da(i)==diff(A,Y(i)) from which I will have as a solution the Y array as a function of D.
I tried this:
N=10;
Y=sym('Y',[1 N]);
X=sym('X',[1 N]);
syms D
A=0;
for i=1:N
X(i)=sqrt(D^2-Y(i)^2);
A=A+ Y(i)*X(i);
end
dA=sym('dA',[1 N]);
for i=1:N
dA(i)=diff(A,Y(i));
end
S = solve(dA==0);
But I get this: "Warning: Possibly spurious solutions. [solvelib::checkVectorSolutions]" and it is very slow.
Do you think it is a good way to solve my problem? What is the difference if I define a function dA=myfun(D)?

답변 (0개)

카테고리

Help CenterFile Exchange에서 Systems of Nonlinear Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by