MATLAB: Calculating distance for a wave/wind model given in lake coordinates and outline coordinates.

bathymetrydistancefetchfunctionwind

Making a wave wind model of Lake Superior. I have xyz (lat/long/depth) data for thousands of points in the lake. I also have data showing the outline of the lake. I need to be able to calculate the fetch distance for every point given a wind angle. The issue is identifying the shoreline point to use to calculate the distance. Looking for a function that can create a vector from in lake points to a point on the shore in the direction of the wind. The end goal is to assign fetch distance to every point, and have wind direction as a variable i can change. Fairly new to Matlab and looking for all the help I can get. Thanks!!

Best Answer

So, you know the angle...._theta_ that means you know the slope.....and you have a point from which you want to calculate where it intersects the boundary/ shoreline. Do the following:
1. Get the slope of straight line as you know the angle. (m = tan(theta))
2. Get the equation of straight line with known slope m and passing through the point (x,y).
3. From the equation you will get the set of points lying on the straight line.
4. So now you have two set of points. One set is points of straight line and other set is set of points of shore line/ boundary. Now you need to get the intersection point. Use this function InterX to get the intersection points. https://in.mathworks.com/matlabcentral/fileexchange/22441-curve-intersections?focused=5165138&tab=function