How to define ranges for solutions in this example

17 次查看(过去 30 天)
Hello,
i got the following code to create a formula which includes 4 parameters, which i want to estimate:
syms A B b t0 real
x11=-1;x21=-1;x31=1;x41=1;
x1=[x11;x21;x31;x41];
x12=-1;x22=1;x32=-1;x42=1;
x2=[x12;x22;x32;x42];
t1=98; t2=52.5; t3=29; t4=24;
Versuchsdaten=[t1;t2;t3;t4];
logL=0;
for i=1:length(Versuchsdaten)
logL=logL+log(b/(exp((A*x1(i)+B*x2(i)+A*B*x1(i)*x2(i)))-t0))+log(((Versuchsdaten(i)-t0)/(exp((A*x1(i)+B*x2(i)+A*B*x1(i)*x2(i)))-t0))).^(b-1)-((Versuchsdaten(i)-t0)/exp((A*x1(i)+B*x2(i)+A*B*x1(i)*x2(i))-t0)).^(b);
end
Now i create four partial derivations:
dLdb=diff(logL,b);
dLdt0=diff(logL,t0);
dLdA=diff(logL,A);
dLdB=diff(logL,B);
After that, im solving this equations:
[b_hat, t0_hat, A_hat, B_hat] = vpasolve([dLdb==0, dLdt0==0, dLdA==0, dLdB==0],[b, t0, A, B]);
And i get following results:
0.22827585315780297509118525877644
-1.1888587849400038882573418242591
-0.10771134364438446209957736245859
-0.050991408729052753335794920302386
The problem is, the solutions must be in defined ranges.
The ranges are: [0 Inf] for b and t0, [-1 1] for A and B. How can i do that? I already tried:
[b_hat, t0_hat, A_hat, B_hat] = vpasolve([dLdb==0, dLdt0==0, dLdA==0, dLdB==0],[b, [0 Inf] t0,[0 Inf] A,[-1 1] B, [-1 1]]);
and
[b_hat, t0_hat, A_hat, B_hat] = vpasolve([dLdb==0, dLdt0==0, dLdA==0, dLdB==0],[b, t0, A, B], [0 Inf], [0 Inf], [-1 1], [-1 1]);
I hope you can understand my problem and try to help me.

采纳的回答

Karan Gill
Karan Gill 2017-7-25
编辑:Karan Gill 2017-10-17
To specify ranges for multiple variables, see the last example on Solve Equations Numerically called " Solve Multivariate Equations Using Search Ranges"

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Formula Manipulation and Simplification 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by