Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


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

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)
p2=parameter2(j);
[x,Fval,exitflag] = fsolve(@(x)myfun(x,p1,p2),x0);
...
end
end

Best wishes
Torsten.



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

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.