| 查看: 556 | 回复: 2 | ||
[求助]
Matlab 解方程问题求教!!!
|
|
代码1,求解sym类型参数方程中未知数。 以下是MATLAB程序代码,我运行之后提示“FZERO cannot continue because user supplied function_handle ==> @(x)(sum((y'./beta')./(1/alpha_t*ones(size(gamma))-1./gamma))-K) failed with the error below.”,作为新手有点看不懂,不会改了,求大神帮忙,先谢谢了。 需要输入的内容如下: the number of the variables:8 K:12.2 y:[0.04 0.44 6.16 24.98 37.23 25.43 5.69 0.05] alpha_t:0.527 d:[60.7 28.3 13.2 6.1 2.9 1.3 0.6 0.3] 程序代码 clc;clear;close all n=input('the number of the variables:'); K=input('K:'); y=input('y:'); alpha_t=input('alpha_t:'); d=input('d:'); if (length(y)~=n||length(d)~=n) disp('please input the same number as n'); break; end syms beta; gamma=sym(zeros(n,1)); for i=1:n sum1=0; sum2=0; if i==1 for j=i+1:n aij=sqrt(1-(1-d(j)/d(i))^1.02); sum2=sum2+aij/beta*y(j); end gamma(1)=1/(y(1)/beta+sum2+sum1); end if i==n for j=1:i-1 bij=1-(1-d(i)/d(j))^1.5; sum1=sum1+(1-bij*(1-1/beta))*y(j); gamma(i)=1/(y(i)/beta+sum1+sum2); end end if i<n&&1<i for j=1:i-1 bij=1-(1-d(i)/d(j))^1.5; sum1=sum1+(1-bij*(1-1/beta))*y(j); end for j=i+1:n aij=sqrt(1-(1-d(j)/d(i))^1.02); sum2=sum2+aij/beta*y(j); end gamma(i)=1/(y(i)/beta+sum1+sum2); end end fun=@(x)(sum((y'./beta')./(1/alpha_t*ones(size(gamma))-1./gamma))-K); x1=0; x2=1; x=fzero(fun,0.6) abs(fun(x)) beta1=x; disp(['beta:']) beta1; |
» 猜你喜欢
求助中医院临床中医中标的青年标书学习,谢谢
已经有6人回复
浙大物院表面物理课题组长期招收普博及直博学生
已经有259人回复
物理学I论文润色/翻译怎么收费?
已经有163人回复
【征稿】Springer Nature热电专题 Discover Materials / Discover Chemistry
已经有47人回复
25届硕士申请,材料计算方向
已经有2人回复
课题组招1-2名硕士
已经有1人回复
机时越来越贵之后,我把一部分 DFT 流程搬到了 AI 计算平台上
已经有0人回复
斯坦福大学与Elsevier世界前2%学者新排名查询
已经有1人回复
27申博推荐:南京航空航天大学国际前沿院光学方向招收博士生!
已经有19人回复
华南师范大学+双一流学科物理学+广东省杰青团队2027年博士招生+机器学习驱动材料设计
已经有1人回复
apl投稿状态
已经有1人回复

2楼2016-03-22 21:13:59
3楼2016-03-22 23:38:30










回复此楼