求教,
matlab什么时候用“*”,什么时候用“.*”啊?
如下,将".^",".*"改为^,*行吗?
volts=120;
rs=50;
%Create an array of load resistances
rl=1:1:100;
%Calculate the current flow for each resistance
amps=volts./(rs+rl);
%Calculate the power supplied to the load
pl=(amps.^2).*rl;
%Plot the power versus load resistance
plot(rl,pl);
title('Plot of power versus load resistance');
xlabel('Load resistance(ohms)');
ylabel('Power(watts)');
grid on;