2016-11-07 14 views
0

對不起我只是在學習,但我嘗試理解爲什麼這行代碼是在行電工(第17行) P導致錯誤17.變量p改變大小,每個互爲作用錯誤

錯誤( i,j)= p * A(i)* E(i)* 0.01; %的總的平均日發電(二維矩陣)

clear all; 
close all; 
%-------------------------------------------------------- 
% Vector of available area widths (a 1D array of numbers) 
Wmiles = [1:1:150; % width of the square area in miles (vector or 1D array) 
Wmeters = Wmiles*1609; % width of the square area in meters (vector or 1D array) 
A = Wmeters*Wmeters; % area in m^2 (vector or 1D array); note element-by-element 
         % vector multiplication! 
%-------------------------------------------------------- 
% Vector of available array efficiencies (a 1D array of numbers) 
E = [1:1:20];   % efficiency percentage (vector or 1D array)   
%-------------------------------------------------------- 
% Matrix of all available total output powers of the array (a 2D array of numbers) 
p = 270.9;     % average daily solar radiation in W per m^2 (scalar) 
for i = 1:length(A)   % index i corresponds to different areas A 
    for j = 1:length(E)  % index j corresponds to different efficiencies E 
     P(i,j) = p*A(i)*E(i)*0.01; %"Causing ERROR" total average daily power (2D matrix)  
    end 
end 
%-------------------------------------------------------- 
% "Plot" the matrix - a contour plot of all available total output powers 
v  = [2 10 50 100 300 500 1000]; % create contour plot levels in GWatts 
C = contourf(P*1e-9, v);  % create contour plot of output powers in GWatts 
colormap(summer); 
clabel(C, 'FontSize', 11, 'Color', 'r'); % be fancy (do not have to) 
grid on; xlabel('Efficiency, %'); ylabel('Area size, m^2'); 

回答

0

你需要E(j)在E(I)匹配指數