不能转化为显式的函数 多个函数值 求 自变量。

现在有很多b值,需要求解对应的a值,我利用了下面的代码,可以求出结果,但效率有点低(大约需要30s),请问大家,这个有优化的方法吗?
先定义一个函数
function y=kine2222(b)
syms a;
y1=solve(b-(a+(1-a)*log(1-a)),a);
y=eval(y1);
再使用arrayfun
b=[1:1:100];
arrayfun(@(b)kine2222(b),b)

 Réponse acceptée

0 votes

fun=@(x) x+(1-x).*log(1-x);
x1=-40:0.001:0;
y1=fun(x1);
x=spline(y1,x1,1:100)

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!