Obtaining the minimum value of solutions

5 次查看(过去 30 天)
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

采纳的回答

Star Strider
Star Strider 2018-9-3
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).
See the documentation section on Smallest Complex Element (link) for details.
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Numbers and Precision 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by