Effacer les filtres
Effacer les filtres

Nesting the value of variable in fsolve?

3 vues (au cours des 30 derniers jours)
Joon Jeon
Joon Jeon le 31 Mar 2012
I am trying to nest a variable in function f(E). And thes variable, say V, is also a function of E.
For example,
V=exp(E(1))+E(2);
f=@(E) [E(1)+34*E(2); E(1)+(2+V*8)*E(2)]
The above code is hypothetical for better presentation for you.
If we run this kind of problem(I will fsolve it), it will show error such as E(1) and E(2) is not defined.
So if I code
syms E
then it will not deliver answer from function f.
What can you suggest when solving this problem?
ps. Again, above example is just an example. Thanks!
I love Matlab!!!

Réponse acceptée

Andrei Bobrov
Andrei Bobrov le 31 Mar 2012
use
V = @(E)exp(E(1)) + E (2);
F = @(E)[E (1) +34 * E (2), E (1) + (2 + V(E) * 8) * E (2)]
OR
F = @(E)[E(1) +34 * E(2), E(1) + (2 + (exp(E(1)) + E(2))*8)* E(2)]
  1 commentaire
Joon Jeon
Joon Jeon le 31 Mar 2012
Thanks, it worked!
Could you answer my another question if you don't mind?
Question Below:
http://www.mathworks.se/matlabcentral/answers/34089-can-i-use-this-result-after-fsolve

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements 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