Obtaining the minimum value of solutions
조회 수: 18 (최근 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
댓글 수: 0
채택된 답변
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).
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개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!