-
Notifications
You must be signed in to change notification settings - Fork 2
/
generateMatrices.m
31 lines (24 loc) · 1.25 KB
/
generateMatrices.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
%========================================================================
% generateMatrices
% version 1.0 - January 18th, 2017
%
% Initializes the matrices and vectors to be used in the computation of
% the wind speed/wind direction joint PDFs and in the computation of the
% LT algorihtm.
% input parameters:
% dir_bin_size - wind direction bin size (degrees)
% speed_bin_size - speed bin size (m/s)
% speed_range - min and max values of the wind speed to be considered in the modeled PDF
%
% outputs:
% dir_mesh, speed_mesh - rectangular grids that contain the state
% tuples (wind direction,wind speed) for each state of the discrete joint PDF
% dir_states, speed_states - vectors that contain the possible wind speed/wind
% direction values of the discrete joint PDFs
%========================================================================
function [dir_mesh,speed_mesh,dir_states,speed_states]=generateMatrices(dir_bin_size,speed_bin_size,speed_range)
n_dir=round((359.9)/dir_bin_size);
dir_states=linspace(0,359.9,n_dir);
n_speed=round((speed_range(2)-speed_range(1))/speed_bin_size);
speed_states=linspace(speed_range(1),speed_range(2),n_speed);
[dir_mesh,speed_mesh]=meshgrid(dir_states,speed_states);