Synthetic data with monte carlo

조회 수: 9 (최근 30일)
Nikolas Spiliopoulos
Nikolas Spiliopoulos 2021년 11월 18일
답변: Saurav 2024년 2월 26일
Hi all,
I would like to create synthetic data from a given timeseries, using monte carlo simulation. I assume a normal distribution
the time series dats is something like that:
load_demand_1 =[0.20, 0.23, 0.25, 0.18, 0.22, 0.45, 0.68, 1.02, 0.68, 0.20, 0.34, 0.37, 0.52, 0.54, 0.75, 0.84, 2.40, 1.80]
Is there any way to do it, desides the usual random function that creates lot of noise?
thanks in advance!

답변 (1개)

Saurav
Saurav 2024년 2월 26일
Hi Nikolas,
According to what I understand, you want to use Monte Carlo simulation to create synthetic data using the provided time series data in a normally distributed manner.
Here are the steps that you need to take:
  1. Determine the mean and standard deviation of your original time series data.
  2. Using the mean and standard deviation, you can generate new data points that follow a normal distribution. This can be done using the function “normrnd”, which produces numbers that follow the pattern of a normal distribution.
Here is a workaround that can be followed:
load_demand_1 = [0.20, 0.23, 0.25, 0.18, 0.22, 0.45, 0.68, 1.02, 0.68, 0.20, 0.34, 0.37, 0.52, 0.54, 0.75, 0.84, 2.40, 1.80];
mean_load = mean(load_demand_1); %calculate mean of the data
std_load = std(load_demand_1); %calculate standard deviation of the data
% Generate synthetic data using Monte Carlo simulation
num_samples = 20000; % Number of synthetic data points to generate
synthetic_data = normrnd(mean_load, std_load, [4, num_samples]); %creates 4 set of 20,000 data points
Also, "histfit" function can be used to confirm whether or not the obtained data follows a normal distribution.
To confirm the result generated, try the code below:
histfit(synthetic_data(1,:));
You can refer to the following documentation to learn more about the functions “normrnd” and “histfit”:
I hope this helps, Thanks!

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by