Find value of beta
2 次查看(过去 30 天)
显示 更早的评论
0.45 = c1 * (c2*k - c3*Beta - c4.*Beta.^c5 -c6).* exp( -c7 *k);
where
k=1./(x+c8.*Beta)-c9./(Beta.^3+1);
and
x=4;
c1=0.73 ;
c2=151 ;
c3=0.58 ;
c4=0.002 ;
c5=2.14 ;
c6=13.2 ;
c7=18.4 ;
c8=-0.02 ;
c9=-0.003;
1 个评论
John D'Errico
2018-9-9
编辑:John D'Errico
2018-9-9
Please, learn to format your code so that it is readable. I did it for you here.
https://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup#answer_18099
回答(1 个)
John D'Errico
2018-9-9
编辑:John D'Errico
2018-9-9
If these are known:
x=4;
c1=0.73 ;
c2=151 ;
c3=0.58 ;
c4=0.002 ;
c5=2.14 ;
c6=13.2 ;
c7=18.4 ;
c8=-0.02 ;
c9=-0.003;
and beta is an unknown variable, then there are two choices. Either solve for the roots of your equation using a tool like fzero, or try to use the symbolic toolbox, thus solve or vpasolve.
The problem is that beta appears inside k, and then you take the exponential of k. You also find beta and k outside the exponential. So unless you get lucky, and MATLAB is able to do some LambertW work here, there will probably be NO analytical solution. Its probably just not gonna happen (in fact, I'll make that HIGHLY probably not gonna happen.) That means you will need to look for a numerical solution. That means either vpasolve, or fzero.
But nothing stops you from trying it!!!!! Sigh. First plot things. Always plot EVERYTHING that you can plot.
kfun = @(beta) 1./(x+c8.*Beta)-c9./(Beta.^3+1);
betafun = @(beta) c1 * (c2*kfun(beta) - c3*Beta - c4.*Beta.^c5 -c6).* exp( -c7 *kfun(beta)) - 0.45;
ezplot(betafun)
(error stuff generated.)
Oops. Now I realize that you seem to use Beta and beta, as if MATLAB should not be case sensitive. IT IS!!!!!!! Case matters.
By the way, it is a REALLY bad idea to use beta as a variable name, as that will overload the very useful function beta.m. I'm gonna go with Beta.
kfun = @(Beta) 1./(x+c8.*Beta)-c9./(Beta.^3+1);
Betafun = @(Beta) c1 * (c2*kfun(Beta) - c3*Beta - c4.*Beta.^c5 -c6).* exp( -c7 *kfun(Beta)) - 0.45;
ezplot(Betafun,[-10,10])
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/195263/image.jpeg)
Hmm. It looks like for negative values of Beta, you get nothing out, which here implies complex results. If we go up as far as 200, it looks like it never crosses 0.
ezplot(Betafun,[0,200])
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/195264/image.jpeg)
But then around 200, something goes crazy, and it looks like you get garbage between around [200,210] or so, where it comes up from -inf. But it still never crosses the x axis.
ezplot(Betafun,[0,10000])
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/195265/image.jpeg)
So, before you try to solve a problem that has no solution, look carefully at it.
The rest is up to you. There may be complex solutions that vpasolve MIGHT be able to find.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!