| 查看: 460 | 回复: 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; |
» 猜你喜欢
【修正版】单环用磁约束低速电子实验方案(简化版)
已经有0人回复
桂林理工大学物理学专业招收调剂,还有三个名额!!!
已经有22人回复
物理学I论文润色/翻译怎么收费?
已经有259人回复
考博自荐
已经有4人回复
山东大学第二批博士研究生招生
已经有0人回复
中国科学院东莞材料科学与技术研究所-2026年博士招生-吴昊研究员-磁学与自旋电子学
已经有0人回复
《电磁学》教材推荐
已经有1人回复
【急招】合肥工大核聚变材料计算方向2026级工程博士生
已经有4人回复
大豆异黄酮分离
已经有0人回复
湖南大学材料学院急招2026年博士生,临时增加一名博士联培指标
已经有10人回复
天津理工大学晶体材料全国重点实验室刘红军教授课题组招收博士生1-2名
已经有0人回复

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












回复此楼