The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Solving equations with "extra parameters" (passing extra parameters)
Replies: 1   Last Post: Aug 31, 2012 3:01 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Torsten Hennig

Posts: 2,419
Registered: 12/6/04
Re: Solving equations with "extra parameters" (passing extra parameters)
Posted: Aug 31, 2012 3:01 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

> Hi everyone,
> Im trying to solve a system of two eq and two
> unknowns. I want to solve this system for different
> values of two parameters.
> What i did is create a vector with this values and
> try to use two for loops to get the desired result
> using solve command.
> The problem is that solve command doesn´t allow the
> parameters to change!
> I tried using anonymous functions and nested
> functions but couldn´t solve the problem.
> Anyone has any ideas??
> Thank you very much for your time!

If your equations are nonlinear, use fsolve and
call it as

for i=1:length(parameter1)
p1 = parameter1(i);
for j=1:length(parameter2)
[x,Fval,exitflag] = fsolve(@(x)myfun(x,p1,p2),x0);

Best wishes

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.