Problem with symbolic variables system

1 Ansicht (letzte 30 Tage)
xrysa
xrysa am 17 Mär. 2014
Bearbeitet: Walter Roberson am 17 Mär. 2014
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)?

Antworten (0)

Kategorien

Mehr zu Systems of Nonlinear Equations 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!

Translated by