搜索内容 搜索用户

# [已解决] 使用fsolve函数​求解非线性方程组，报​错Initial point must be non-empty

150li 发表于 2021-12-8 13:19:16
 clear; clc; % tin = 190;         % ℃ compressor_p.T_in = tin;       % 入口温度 ℃ compressor_p.M = 0.015;        % 质量流量 kg/s compressor_p.n = 640/60;      % 转速 rad/s compressor_p.v = 0.2e-03;     % 压缩机有效吸气体积 e-03 % problem.y0 = [295; 8000; 2.5];  %我这里明明给了初值 problem.options = optimoptions('fsolve','Display','iter-detailed','PlotFcn',@optimplotfirstorderopt); problem.objective = @(my) compressor(my,compressor_p); problem.solver = 'fsolve'; [y,fval] = fsolve(problem); T2 = y(1); P2 = y(2); K = y(3) 下面是我求解的方程组 function F = compressor(y,compressor_p) Rname='water'; T0=273.15; %  输入 T1 = compressor_p.T_in; m = compressor_p.M; N = compressor_p.n; V = compressor_p.v; P1 = refpropm('P','T',T1+T0,'Q',1,Rname); %  输出 T2 = y(1); P2 = y(2); K = y(3); F(1) = T2/T1 - (P2/P1)^((K-1)/K); F(2) = m * (refpropm('H','T',T2+T0,'P',P2,Rname) - refpropm('H','T',T1+T0,'Q',1,Rname))/1000 ...     - N * V * K/(K-1) * P1 * ((P2/P1)^((K-1)/K) - 1); F(3) = refpropm('S','T',T1+T0,'Q',1,Rname) - refpropm('S','T',T2+T0,'P',P2,Rname); end

TouAkira 发表于 2021-12-8 13:54:59
 fsolve函数 帮助文档里面写的明明是x0 problem — Problem structure Problem structure, specified as a structure with the following fields: Field Name        Entry objective         Objective function x0         Initial point for x solver         'fsolve' options         Options created with optimoptions

1 条回复

## 倒序浏览

TouAkira 发表于 2021-12-8 13:54:59
 fsolve函数 帮助文档里面写的明明是x0 problem — Problem structure Problem structure, specified as a structure with the following fields: Field Name        Entry objective         Objective function x0         Initial point for x solver         'fsolve' options         Options created with optimoptions
 您需要登录后才可以回帖 登录 | 注册 本版积分规则 回帖后跳转到最后一页