MATLAB: How to solving equation with trials

equationsolvetrials

hi all, i'm a student and i've a assingment and i'm kind a new with matlab.
i have an equation with 2 variables, its like r=(x,T)
i want x and y values to make r=0 and then i will plot a graph to T to x. in more specificly its a rate equation for ammonia synthesis and i'm trying to plot a conversion vs temperature graph.
i try solve with solve(r,T). with this command , i think my equation is kind a complicated and matlab gives an warning; "Warning: Explicit solution could not be found. "
so i'm trying to solve with trials, i want T changes in a to b, and x changes in c to d and which values gives r=0 (10^-3 will be enough to accept 0) display to me this x and T values or even plot a graph.
i know i should use 2 'for loop' like
for T=a:1:b and for x=c:0.01:d
but i dont know how to arrange to r=0 (or 0<=r<=10^-3) and display x,y for r=0.

Best Answer

The fminsearch function might work, but assuming T is temperature and you want to solve for different values of x at defined values of T that make r=0, I suggest fzero. You did not post your function so I cannot run code and test it. (I do not know what r returns as output, or how it works.)