Dealing with changing lat/lon values within equation with multiple gradients.
3 次查看(过去 30 天)
显示 更早的评论
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!
0 个评论
回答(1 个)
Andrew Newell
2011-3-30
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;
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).
0 个评论
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!