| 查看: 397 | 回复: 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; |
» 猜你喜欢
基元I理论下三大核心空间现象精准推导与细节解析
已经有0人回复
基于基元 I 统一理论的反重力理论推导
已经有0人回复
物理学I论文润色/翻译怎么收费?
已经有55人回复
基于基元I统一理论的量子力学本源推导
已经有1人回复
推荐一款可以AI辅助写作的Latex编辑器SmartLatexEditor,超级好用,AI润色,全免费
已经有20人回复
【EI|Scopus 双检索】第六届智能机器人系统国际会议(ISoIRS 2026)
已经有1人回复
2026年第四届电动车与车辆工程国际会议(CEVVE 2026)
已经有0人回复

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













回复此楼