MATLAB中fsolve解非线性方程问题clear all;clc;close all;N1=1;%N2=2;%%P1=750/1120;f=50;%%%%基值定义开始%定SacB=1120;%MVAUacB=550;%kVIacB=SacB/UacB/(sqrt(3));ZacB=UacB*UacB/SacB;%ohm%定义SdcB=1120;UdcB=250;K=UdcB/UacB;IdcB=sqrt(3)*IacB/

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/06 10:01:05
MATLAB中fsolve解非线性方程问题clearall;clc;closeall;N1=1;%N2=2;%%P1=750/1120;f=50;%%%%基值定义开始%定SacB=1120;%MVAU

MATLAB中fsolve解非线性方程问题clear all;clc;close all;N1=1;%N2=2;%%P1=750/1120;f=50;%%%%基值定义开始%定SacB=1120;%MVAUacB=550;%kVIacB=SacB/UacB/(sqrt(3));ZacB=UacB*UacB/SacB;%ohm%定义SdcB=1120;UdcB=250;K=UdcB/UacB;IdcB=sqrt(3)*IacB/
MATLAB中fsolve解非线性方程问题
clear all;clc;close all;
N1=1;%
N2=2;%%
P1=750/1120;
f=50;
%%%%基值定义开始
%定
SacB=1120;%MVA
UacB=550;%kV
IacB=SacB/UacB/(sqrt(3));
ZacB=UacB*UacB/SacB;%ohm
%定义
SdcB=1120;
UdcB=250;
K=UdcB/UacB;
IdcB=sqrt(3)*IacB/K;
ZdcB=K*K*ZacB;
%%%%基值定义完毕
%%
Kb=2;
Kp=1;
Kunit=1;
Dxi=Kb*0.12*3/pi/K/K*SacB/450;
Dxr=Kb*0.12*3/pi/K/K*SacB/450;
Tr=(1.05*525/105.75);
Ti=(1.0375*525/105.75);
Rdc=20/ZdcB;
gam=17/180*pi;
Ids=3/IdcB;
pi=3.14159;
P2=0;
Q2=0;
P3=0;
Q3=0;
v1=1.08;
v4=1;
R12=6.875E-9*16000*500*500/100/ZacB/N2;
X12=1.0E-7*16000*500*500/100/ZacB/N2+0.181/N1;
R34=0;
X34=0.0732*2*pi*f/ZacB;
R22=4.7241/Kunit/ZacB;X22=-340.2973/Kunit/ZacB;
R33=4.7812/Kunit/ZacB;X33=-308.5175/Kunit/ZacB;
%R22=16.6152/Kunit/ZacB;X22=-638.0362/Kunit/ZacB;
%R33=16.611/Kunit/ZacB;X33=-574.8844/Kunit/ZacB;
l=1;
syms deta1 v2 deta2 v3 deta3;
%五个未知数;需要五个方程
eq1=P1-real(v1*(cos(deta1)+j*sin(deta1))*conj((v1*(cos(deta1)+j*sin(deta1))-v2*(cos(deta2)+j*sin(deta2)))/(R12+j*X12)));
eq2=-P2+real(v2*(cos(deta2)+j*sin(deta2))*conj((v2*(cos(deta2)+j*sin(deta2))-v1*(cos(deta1)+j*sin(deta1)))/(R12+j*X12)))+Kp*(3*sqrt(2)*Kb*v3/pi/Ti/K*cos(gam)+(Rdc-Dxi)*Ids)*Ids;
eq3=-Q2+imag(v2*(cos(deta2)+j*sin(deta2))*conj((v2*(cos(deta2)+j*sin(deta2))-v1*(cos(deta1)+j*sin(deta1)))/(R12+j*X12)))+126*3/SacB+Kp*Ids*(sqrt((3*sqrt(2)*Kb*v2/pi/Tr/K)^2-(3*sqrt(2)*Kb*v3/pi/Ti/K*cos(gam)+(Rdc-Dxi)*Ids)^2));
eq4=-P3+real(v3*(cos(deta3)+j*sin(deta3))*conj((v3*(cos(deta3)+j*sin(deta3))-v4)/(R34+j*X34)))-Kp*(3*sqrt(2)*Kb*v3/pi/Ti/K*cos(gam)-Dxi*Ids)*Ids;
eq5=-Q3+imag(v3*(cos(deta3)+j*sin(deta3))*conj((v3*(cos(deta3)+j*sin(deta3))-v4)/(R34+j*X34)))+126*3/SacB-Kp*Ids*(sqrt((3*sqrt(2)*Kb*v3/pi/Ti/K)^2-(3*sqrt(2)*Kb*v3/pi/Ti/K*cos(gam)-Dxi*Ids)^2));
eq=['F=' char('[') eq1 char(';') eq2 char(';') eq3 char(';') eq4 char(';') eq5 char(']') char(';')];
fid=fopen(['pffun' num2str(l) '.m'],'w');
fwrite(fid,'function F = pffun(x)');
fwrite(fid,char(13));
fwrite(fid,eq);
fwrite(fid,char(13));
fwrite(fid,'return');
fclose(fid);
主函数为
icount=1;
fun=str2func(['pffun' num2str(icount)]);
sol=fsolve(str2func(['pffun' num2str(icount)]),[0.48;1.165; 0.3;1.02;0.118]);
%syms deta1 v2 deta2 v3 deta3;
为什么得到以下结果
Optimizer appears to be converging to a point which is not a root.
Norm of relative change in X is less than max(options.TolX^2,eps) but
sum-of-squares of function values is greater than or equal to sqrt(options.TolFun)
Try again with a new starting guess.
有时又是这样的结果Maximum number of function evaluations reached:
increase options.MaxFunEvals.

MATLAB中fsolve解非线性方程问题clear all;clc;close all;N1=1;%N2=2;%%P1=750/1120;f=50;%%%%基值定义开始%定SacB=1120;%MVAUacB=550;%kVIacB=SacB/UacB/(sqrt(3));ZacB=UacB*UacB/SacB;%ohm%定义SdcB=1120;UdcB=250;K=UdcB/UacB;IdcB=sqrt(3)*IacB/
第一个结果是说,精度options.Tol已经满足要求,但这个精度options.TolFun不满足,让你更改初值试试.
第二个结果是说已经达到最大计算次数,可以通过提高options.MaxFunEvals来增加计算次数.
matlab也是做数值计算的,对计算非线性函数难免受初值选取、精确度满足、步长选择等影响.上面的问题基本也是这样,可以通过设置options来修正,options是个大域名,计算后可以通过在命令窗口输入options来查看各个变量,输入options.变量名 来查看各个变量值,比如options.MaxFunEvals.
x = fsolve(fun,x0,options)你可以多了解下它的用法,网上有很多,第三项是options选项,options各变量有默认值,你可以更改,来控制计算.
如果再不能的话,估计就是函数太过复杂,或太过矫情,不是fsolve所能计算的.
options=optimset('MaxFunEvals',...)
optimset
Display:[ off | iter | notify | final ]
MaxFunEvals:[ positive scalar ]
MaxIter:[ positive scalar ]
.

matlab 中fsolve求解非线性方程组可以给定解的区间么 matlab中fsolve可否用来解四元非线性方程组?急! matlab怎么用fsolve函数解非线性方程组? MATLAB fsolve 解非线性方程(si^4.108*(-29313320863876.9)+si^3.081*(-1455573982281.561)+si^2.054*(17838323550.297)+si^1.027*(-18264.9538))/65.5-si用fsolve 这个方程,为什么找不到值?(no solution found)fsolve stopped because the last 关于matlab中fsolve的使用当用fsolve解非线性方程组时,x=fsolve(fun,x0),x0是初始矩阵,麻烦最好举个例子说明下, matlab解非线性方程组,只限定非负解用fsolve命令如何实现?只要非负的解. matlab解非线性方程问题 matlab中存在非线性抛物型方程吗 用matlab解个非线性方程.其中已知,并且已经分别导入到了工作空间中,分别存放在变量A(列向量),B(列向量),C(方阵)中,试用fsolve解这个方程组,写出相应的程序 如何用matlab解非线性方程? matlab如何解非线性超标定方程 用matlab求非线性方程的符号解.sqrt(x^2+y^2)-100=03*x+5*y-8=0这可以用solve吗?求fsolve代码 MATLAB中fsolve解非线性方程问题clear all;clc;close all;N1=1;%N2=2;%%P1=750/1120;f=50;%%%%基值定义开始%定SacB=1120;%MVAUacB=550;%kVIacB=SacB/UacB/(sqrt(3));ZacB=UacB*UacB/SacB;%ohm%定义SdcB=1120;UdcB=250;K=UdcB/UacB;IdcB=sqrt(3)*IacB/ 用Matlab的fsolve解方程,本人matlab白痴,求详述! 关于Matlab求解非线性隐式方程组的求解,利用fsolve,solve,或ezplot等自带函数求解,想直接求解x*y=4;x^y=4;的解,我用一下方法及fsolve函数发现求不出来,但是试了其他简单的方程就可以求出来.以下是 matlab中fsolve解非线性方程组算例>> syms x yeq1=(1-0.14*x^2)*(0.3+0.7*exp(-0.65*x^6))-0.2537*y;eq2=x-3.9735*y;ezplot(eq1)hold onezplot(eq2)x0=[2 1;-4 -1]for ii=1:2[x fval]=fsolve(@f,x0(ii,:))end运行时总出现Error:f was previously used MATLAB中fsolve初值怎么确定?% fsolvef = @(x) x-sqrt(1+x)p = @(x) x^2-x-1x2 = fsolve(f, 1)x3 = fsolve(f, -1)x4 = fsolve(p, 1)x5 = fsolve(p, -1) 用fsolve求解方程,为什么x2初值取1,得到x2 =1.6180No solution found.到底应该怎么取 用matlab怎么求解含有三角函数的非线性方程中解x为多少?