Um, you cannot optimize TWO things at once.
There is no reason to assume that they will both achieve their respective optimal values at the same point in your parameter space, and if not, then how will you make the tradeoff?
Oh, and it is a really bad idea to name your variable eps, since that is the name of a really useful function in MATLAB. Do that, and one day soon you will be moaning and asking why the function named eps no longer works for you.
Next, I wonder what you think this does:
Answer: nothing. It dumps the value of c/t in the bit bucket after computing it.
What else? It appears from your code that h and d are fixed constants. So what are you hoping to optimize?
If I had to make a wild guess, I think you want to have two functinos of the variables h and d, where h and d have some unknown value, NOT the fixed value you gave them.
Oh, and learn to use scientific notation. It will make your code easier to write.
But if I look at your relations, they are actually pretty simple. Simple algebra is enough to learn a lot.
Now we can look at your expression for c. c is simply linear in d, and has nothing to do with h. Can we solve for the set of values for d, such that the given relationship holds true? We have c as:
drelation = solve(14*epsilon >= c/t,d,'returnconditions',true)
And that gives us a lower bound on d. Any smaller than that, and your constraint will fail, but ANY value for d greater than -0.01 is acceptable. (x is the unknown d in this.)
Of course, since you have provided only 2 significant digits at most in your numbers, we effectively know that d >= -0.01. Interestingly, d could be zero, and that singularity will be problematic.
Next, we can look at m. m is ALSO a linear function of h. But the constraint applies to m/d. So we have this expression:
124*epsilon - m/d > 0
See that I've written it so that we need this expression to be a positive value.
Where does that relationship hold true? I'll make this into a function so we can plot the positive part.
mfun = @(H) (H-2*t)-2*sqrt(2)*R;
fun = @(D,H) max(124*epsilon - mfun(H)./D,0);
Whereever that plotted surface is greater than zero, you have a valid solution. Since d must be as small as possible, then negative values for d that are greater than -0.01 are good. As long as d is less than zero, then make h = inf, which MAXIMIZES h.
And all of this analysis is probably meaningless, since I doubt that negative values of d even make any sense to you in context. If d must be positive, then make d as close to zero as possible, as long as it is positive. That MINIMIZES d, in which case as long as d is NOT zero but it is positive, the relation for m can be written
124*epsilon*d > m
Since we can make d as small as we wish, as long as it is positive, then this relationship reduces to
m < 0
Reemember that epsilon is positive, as is d, but d approaches zero as close as we can make it. So now we have:
(h-2*t)-2*sqrt(2)*R < 0
And therefore we can trivially solve for h.
h < 2*t + sqrt(2)*R
So the solution that MINIMIZES d as long as d is positive, AND maximizes h is
Where d is as close to zero as possible as long as it is non-zero.
If d can be negative, I've already solved that problem, but somehow I think this solution may be more useful.