0
Leider im nur zu lernen, aber ich bin versucht zu verstehen, warum diese Codezeile verursacht einen Fehler in Zeile 17.Die Variable P ändert die Größe auf jedem interation Fehler
Fehler in Elektrikern (Zeile 17) P (i, j) = p * A (i) * E (i) * 0,01; % Durchschnittliche Tagesleistung (2D-Matrix)
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');