Multiply and integrate two plots for single output value

5 views (last 30 days)
Below is illustrated the code used to compute functions, with a comment at the bottom summarising the aim. To obtain a single value for annual energy output from two plots.
%% Clear Workspace
clc; clear all; clear;
% Define Parameters
K_0 = 3149/1080;
K_1 = 469/1080;
T_1 = 12.4/24; %hours
T_0 = 353/24; %hours
% Define Timestep
ts_min = 2; %mins
ts_hours = ts_min/60;
ts_days = ts_hours/24;
ts_years = ts_days/365;
start_val = 0; % days
end_val = 365; % days
nElements = 1/ts_years; % intervals in a year
ts = linspace(start_val, end_val, nElements); % create timestep array
% Define Harmonic Analysis
V = (K_0 + K_1.*cos((2.*pi.*ts)/T_1)).*cos((2.*pi.*ts)/T_0);
V2 = V.^2;
Vnorm = sqrt(V2);
plot(ts,Vnorm);
grid on;
% Plot Histogram of Wind Velocity Frequencies
hist(Vnorm);
grid on;
%% Tidal Power Curves for 4m and 6.5m from Excel
PowerTable = readtable('TidalData.xlsx','Sheet','Sheet1');
x4 = PowerTable.Header1; % Flow Speed [m/s] at 4m turbine
y4 = PowerTable.Header2; % Electrical Power [kW] at 4m turbine
x63 = PowerTable.Header3; %: Flow Speed [m/s] at 6.3m turbine
y63 = PowerTable.Header4; %: Electrical Power [kW] at 6.3m turbine
figure;
plot(x4,y4,'DisplayName','4m');
hold on;
grid on;
plot(x63,y63,'DisplayName','6.3m');
hold off;
legend
%% Multiplication Calculation power curve by yearly quantity
% aim to multiply plot(x4,y4)- flow speed (m/s) vs. electrical power (kW),
% by hist(Vnorm)- flow speed (m/s) vs. annual number of hours, to get the total annual
% electrical power kWh in a year..
  4 Comments

Sign in to comment.

Answers (1)

Peter Perkins
Peter Perkins on 27 Mar 2023
Any time the number 365 appears in code, thatr's probably a bug.
You might try to use datetimes and durations in your code, including the plot.

Categories

Find more on Wind Power in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!