Dealing with changing lat/lon values within equation with multiple gradients.

1 view (last 30 days)
Hello,
I am a meteorologist trying to apply this Thermal Front Parameter Equation (pg 3089 in the paper http://journals.ametsoc.org/doi/pdf/10.1175/JCLI3386.1) but the problem is the y-derivative values from gradient would need to be divided by the fixed # meters per spacing (e.g., 111000*2.5 for 2.5 degree spacing), the longitude values need to be divided by the longitudinal spacing which changes with latitude. I am having trouble attempting to code this so if anyone could give advice that would be helpful. I initially had something that looked like this:
tfp = dot(1*gradient(gradient(abs(temp))),gradient(temp)/abs(gradient(temp))));
but my advisor said I was missing what I stated above.
Any help would be great thanks!

Answers (1)

Andrew Newell
Andrew Newell on 30 Mar 2011
I'm not sure how the coordinates in the gradient relate to longitude, but let's just say that the scaling parameters are xs,ys,zs and you define scalingParams = [xs ys zs]. Then you could create a function
function grad = gradScaled(f,scalingParams)
[gx,gy,gz] = gradient(f);
grad = [gx gy gz]./scalingParams;
Next, for particular values of scalingParams, e.g., s0, define an anonymous function
g = @(f) gradScaled(f,s0);
and define
h = @(f) abs(g(f));
Then
tfp = dot(g(h(temp)),g(temp)/h(temp));
(note, by the way, that your first abs is in the wrong place).

Categories

Find more on MATLAB in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!