probability- punctual graphs

조회 수: 10 (최근 30일)
ELISABETTA BILLOTTA
ELISABETTA BILLOTTA 2021년 7월 16일
답변: 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
ELISABETTA BILLOTTA 2021년 7월 16일
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