Azzera filtri
Azzera filtri

Nesting the value of variable in fsolve?

3 visualizzazioni (ultimi 30 giorni)
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!!!

Risposta accettata

Andrei Bobrov
Andrei Bobrov il 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 Commento
Joon Jeon
Joon Jeon il 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

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by