Bivariate probability and histograms

2 views (last 30 days)
Daniel
Daniel on 29 Jan 2012
Hello everyone, I am a student at Politecnico di Torino (Italy), and I'm preparing this job for a Hydraulics Course. I have this problem: I have a (mx2) matrix (m rows, 2 columns), with SGH and PEF observed data (SGH stands for wave height and PEF for wave period). Each possible SGH-PEF couple creates a wave. The main problem is to find the probable power and energy this group of waves could generate. So here are my doubts:
1. First of all I have to calculate the frequency of occurrence of each possible SGH-PEF, that is, of every wave that could exist within this period of time. I did this with a function called histcnd (<http://www.mathworks.com/matlabcentral/fileexchange/30798-n-d-histogram/content/histcnd.m>) that gives me a (pxq) matrix, the matrix dimensions depend on the step given to the vector 'edges'. Then dividing this matrix on the number of observations m, i get the probability of occurrence. Perhaps there is a easier way to calculate these probabilities (probability of a bivariate trial)? Perhaps I can define 'edges' as a vector with specific steps, let's say for example, every 5 values, or perhaps (that would be the best) I could calculate the probability of EACH SINGLE wave?
2. Then I have calculated the power this waves produce, that is given by SGH^2xPEF. This was done by multiplying the firs vector SGH by PEF transposed. The result is a (mxm) matrix (being m the numbers of observations). What comes next is to calculate the probabilities of these powers. It should be done multiplying the probabilities former calculated by these powers now calculated. The problem is the matrix I have calculated do not match in dimensions. So I can multiply them. A solution I thought about is to average the powers at a specif grid, so that it would match the dimensions of the probabilities matrix. But I don't know how to do this, and also I don't know if this is correct.
3. Finally, multplying every 'probable power' by the quantity of hours in a year, I get the 'probable energy' given by this trial of waves. The last thing to do is to "integrate" this probable energies, so as to get the Total Energy given by the trial of waves the year being (that is to sum all of the values inside the matrix 'probable energy'). This I don't know how to do it.
So maybe the problem is that I should calculate probabilities (the probability of each possible SGH-PEF couple) at first instead of calculating a histogram and then dividing it on the number of observations. Then I would have all matrixs that would match on dimensions. But I can't seem to do this. I'm not really a Matlab user and I really need this help for a Practical Task for my University, that is driving me mad. Maybe (and I hope so) is a silly thing, but I just don't get it.
Thanks a lot and I hope you can help me. Best regards.

Answers (0)

Community Treasure Hunt

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

Start Hunting!