MATLAB设计关于负载获得最大功率的仿真主要参数
10-04
clear
I=input('请输入所测电流数据I=[]:')
U=input('请输入所测电压数据U=[]:') subplot(2,1,1),plot(I,U,'r*'),
p1=polyfit(I,U,1)
y1=polyval(p1,I)
hold on;
plot(I,y1)
legend('原始点',' 填充线')
title('戴维南定理电路实验的伏安特性曲线U-I'); xlabel('I/A');
ylabel('U/V');grid
fprintf('等效内阻为:')
Req=abs(p1(1,1))
fprintf('开路电压为:')
Uoc=p1(1,2)
fprintf('当')
Rl=Req
fprintf('负载获得最大功率为:')
Pmax=Uoc^2*Rl/(Req+Rl)^2
Rl=0:Req/1000:10*Req;
P=Uoc^2*Rl./((Req+Rl).*(Req+Rl));
subplot(2,1,2),plot(Rl,P),grid on
hold on
plot(Req,Pmax,'r.')
text(1.3,Pmax,'(1.2006,3.4952)')
title('功率随负载的变化曲线P-R');
xlabel('负载电阻Rl/Ω');
ylabel('负载Rl 获得功率/w');