赞
踩
两节点潮流计算题目如下,这个题目用Newton-Raphson(牛拉法)求解,MATLAB编程
Matlab源代码如下
%Newton-Raphson iteration program to solve two-bus system clc; clear; tic; %set initial values:V2---x1 theta2---x2 V1---balance node voltage amplitude V1=1.05; x1=1;x2=0; P=1;Q=0.5; xk=[x1;x2]; xk_1=[0;0]; xList=zeros(20,2);%存放每次迭代后的x1 x2 xList(1,:)=xk'; delta_x=xk_1-xk; k=0;%记录迭代次数 while max(abs(delta_x))>10e-5 %判断是否收敛,误差为10e-5 %计算当前迭代次数k的f(x) f0=[-P+5*V1*x1*cos(x2)-15*V1*x1*sin(x2)-5*x1^2; -Q+5*V1*x1*sin(x2)+15*V1*x1*cos(x2)-14.8*x1^2]; Jacobi=[5*V1*cos(x2)-15*V1*sin(x2)-10*x1 -5*V1*x1*sin(x2)-15*V1*x1*cos(x2); 5*V1*sin(x2)+15*V1*cos(x2)-29.6*x1 5*V1*x1*cos(x2)-15*V1*x1*sin(x2)]; %计算xk_1 xk_1=xk-Jacobi\f0; xk_1(2)=rem(xk_1(2),2*pi); delta_x=xk_1-xk; %准备下次迭代 k=k+1; xk=xk_1; x1=xk_1(1);x2=xk_1(2); xList(k+1,:)=xk_1'; end disp(' v2 theta2(°):'); disp([x1 x2*180/pi]); %弧度转化为角度输出 toc;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。