How to make the sovler faster?

5 views (last 30 days)
Mohammed
Mohammed on 2 Jul 2013
Hi
I am trying to solve this equation for Nf, but every time the solver takes long time, how it is possible to make the solver faster?
Machalife = round(solve(maximumLHS == .5*((((fsc^2)/E)*(Nf)^(2*fse)) + (fsc*fdc*(Nf)^(fse+fde))), Nf))
any help?

Answers (2)

Kwen
Kwen on 2 Jul 2013
I think you can change which numerical method you use, in order to choose one that finds your value faster. There's a few that allow you to start searching at a specific value as well...other than that computational power will help but it is slow in general since there are so many computations to be done normally.

Ian Wood
Ian Wood on 2 Jul 2013
Generally if your variables are dependent on multiple other variables, it takes a longer time to reach the solution, as MATLAB must access variables inside of variables. This takes a lot more memory to do. If you can find a way to solve that equation with the least number of variables possible, you should find that MATLAB can solve your problem much quicker.
As an example, say that fsc and fse are dependent on fsd (i'm not sure if this is the case or not):
fsd = fsc + fse;
you are actually better off inserting "fsc + fse" instead of creating a new variable "fsd" to solve your problem, since fsd requires access to fsc and fse to be created, thus requiring more memory. Also, if fsc and fse have references to other variables, then you are just piling memory on top of memory required to be accessed.
That's why it can take such a long time for an equation to be solved with so many variables involved. Your equation will be longer but you'll find that it can be solved in a much shorter amount of time.
Hope this helps!

Community Treasure Hunt

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

Start Hunting!