Filter löschen
Filter löschen

Nesting the value of variable in fsolve?

3 Ansichten (letzte 30 Tage)
Joon Jeon
Joon Jeon am 31 Mär. 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!!!

Akzeptierte Antwort

Andrei Bobrov
Andrei Bobrov am 31 Mär. 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 Kommentar
Joon Jeon
Joon Jeon am 31 Mär. 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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements 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