clc clear % 数值法 %初值 % t的取值范围 tmin = 0; tmax = 100; % 精度 d_doc = 1; doc = (tmax-tmin)/d_doc; % 参数直接在后面改 Pf = 10; m = 700; ii = 0.03; %记得改 i0 = 0.02; nx = 45; r = 0.70.01; E = 1; theta = 0.1; d = -0.01; gamma = 1; kc = 20; aerfa = 0.7; lamuda = 0.8; fai = 10; beita = 1; w1 = 2; w2 = 1; n = 0.13; P0 = 25; huibig = 25; iworld=0.025; miu=33600; syms ee dp p P1 = -mbeita*(i0+d)huibigPf/(((-faitheta-(w1-w2)E-log(n)+i0beita+dbeita)... (kc-huibig)Pf((-faitheta-(w1-w2)E-log(n)+i0beita)/beita/aerfa)^(aerfa/(aerfa-1)))-beitam(i0+d)E) eqn = miu(-faitheta-(w1-w2)ee-log(n)-iworldbeita)/beita- m(i0+d)... (Ep-kcPf)beita/p/(-faitheta-(w1-w2)E-log(n)+dbeita)/(kc-huibig)/Pf==0; sol = solve(eqn, E); ee = double(sol(sol>0)); % 找到正根 disp(ee); T = linspace(tmin,tmax,doc); dt = T(2)-T(1); for i = 1:doc result_p(i) = P0; p = P0; eqn = (-faitheta-(w1-w2)ee-log(n))/beita+i0-dp/p... -aerfa(beitam(eep-huibigPf)(i0+d)/p/(-faitheta-(w1-w2)ee-log(n)+i0beita+dbeita)... /(kc-huibig)/Pf)^((aerfa-1)/aerfa)==0; temp_dp = solve(eqn,dp); temp_dp = double(min(real(temp_dp))); dp1(i) = temp_dp; P0 = P0 + temp_dpdt; disp(["计算中...",string(i/doc*100)," %"]); end figure plot(T,result_p) xlabel("t") ylabel("p") figure plot(T,dp1); xlabel("t") ylabel("dp") dp_p = dp1./result_p; figure; plot(T,dp_p) xlabel("t") ylabel("dp/p")系统说第四十五行 struct 类型的操作数不支持运算符“>"应该怎么改正
时间: 2024-02-01 21:02:28 浏览: 123
LDPC-PEG算法构造H矩阵.rar_All Clear_Density Evolution_LDPC_PEG法构造H矩阵_密
5星 · 资源好评率100%
非常抱歉,我的回答还是有误。你需要将第45行的 `sol` 先转换成 double 类型,然后再进行大小比较,即:
```
ee = double(sol);
ee = ee(ee > 0);
```
这样就可以找到正根了,同时解决了错误提示。
阅读全文