Problem with symbolic variables system

1 vue (au cours des 30 derniers jours)
xrysa
xrysa le 17 Mar 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)?

Réponses (0)

Catégories

En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by