probability- punctual graphs

2 次查看(过去 30 天)
ELISABETTA BILLOTTA
回答: Leepakshi 2025-2-28
starting from values of intensity and direction of the wind, I created the graphs relating to the probability of obtaining certain values of intensity and direction of the wind at the same time. I used the bar3 function which creates my instigrams in 3d. is there a function that allows me to calculate the same probability but with a punctual graph? that the numerical values are given back to me.
  2 个评论
KSSV
KSSV 2021-7-16
You can extract the numbers in the bins and divide with total number.
ELISABETTA BILLOTTA
I do not understand what you mean

请先登录,再进行评论。

回答(1 个)

Leepakshi
Leepakshi 2025-2-28
Hey Elisabetta,
To calculate the probability of obtaining certain values of wind intensity and direction without using histograms, you can use kernel density estimation (KDE) or other statistical methods to get a continuous probability density function. In MATLAB, you can use the ksdensity function to perform KDE. Here's a general approach:
  1. Prepare Your Data: Ensure your wind intensity and direction data are in two vectors of the same length.
  2. Use ksdensity: The ksdensity function can be used to estimate the probability density function (PDF) for your data.
Here's a basic example of how you can implement this in MATLAB:
% Sample data for wind intensity and direction
intensity = [/* your intensity data */];
direction = [/* your direction data */];
% Create a grid for evaluation
[intensityGrid, directionGrid] = meshgrid(linspace(min(intensity), max(intensity), 100), ...
linspace(min(direction), max(direction), 100));
% Evaluate the joint probability density function using ksdensity
pdfValues = ksdensity([intensity', direction'], [intensityGrid(:), directionGrid(:)]);
% Reshape the PDF values to match the grid
pdfValues = reshape(pdfValues, size(intensityGrid));
% Plot the result
surf(intensityGrid, directionGrid, pdfValues);
xlabel('Intensity');
ylabel('Direction');
zlabel('Probability Density');
title('Joint Probability Density of Wind Intensity and Direction');
This approach will give you a smooth, continuous representation of the probability densities for wind intensity and direction, allowing you to extract numerical values at any point on the grid.
Hope this helped!

类别

Help CenterFile Exchange 中查找有关 Bar Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by