Obtaining the minimum value of solutions
18 views (last 30 days)
Show older comments
Hello,
I would like to collect the "minimum value" of each positive solution corresponding to each "n". After running the program, there are series of solutions for each "n". Would you let me know the way of obtaining the minimum value among the series of solution?
format long e
T=0.1;
k=1.0;
k_1=0.2;
k_2=0.1;
a_p=0.0001;
k_p=a_p/10;
a_q=0.00015;
k_q=0.00002;
theta=0.01;
m1=0.0000005;
m2=0.0000002;
W=0.00002;
syms x
gamma=(a_p*k*k_2)/(k_p*m1*k_1);
for n=1:1:10
equation=[(1+sqrt(gamma*theta^n))/sqrt(gamma+sqrt(theta^n))]^2-[(theta+x)/(1+x)]^(n+1)==0;
sol=vpasolve(equation,x);
fprintf('%d\n',n);
fprintf('%.10e\n',sol(sol>0.0)); <======= Any additional command to take "minimum value" of the solution?
end
0 Comments
Accepted Answer
Star Strider
on 3 Sep 2018
The ‘minimum’ depends on how you want to define it. Most of the results returned in ‘sol’ are complex, and the min function will return the value with the smallest magnitude (absolute value).
In the interim, see if this will do what you want:
fprintf('%.10e\n',min(sol(sol>0.0)));
Experiment to get the result you want.
2 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!