How do I plot a hodograph?

조회 수: 49 (최근 30일)
Russ
Russ 2012년 11월 25일
댓글: Nathan Anderson 2018년 3월 10일
I can't seem to find a function in Matlab that allows me to plot a hodograph. Any ideas?
  댓글 수: 1
Ashim
Ashim 2014년 7월 17일
Did you find a solution to plot a hodgraph. I seem to find a solution to plot the points but since i am not a Matlab expert. I cannot find a way to connect the points within the hodograph...I am positing a minimal example here
Ws = 15.*rand(10,1);
Wd = 360.*rand(10,1);
H = (20:20:200)';
Wd = double(Wd);
Ws = double(Ws);
Wd = Wd.*(pi/180);
[WdX, WsY] = pol2cart(Wd, Ws);
polar(WdX, WsY,':b*');
It would be great if you would write the solution you came to. I am unable to think of something to connect the points within the polar plot

댓글을 달려면 로그인하십시오.

답변 (2개)

bym
bym 2012년 11월 25일
do
compass
or
feather
work?
  댓글 수: 1
Ashim
Ashim 2014년 10월 22일
편집: Ashim 2014년 10월 22일
I do have an answer to connect the points here is the simple Hodograph example. However, i am not sure if the wind direction is correctly displayed. I am sure i am doing something wrong there. Any suggestions to make the wind directions correct??
if true
%code
Ws = [6.4;6.7;7.4;7.4;7.7;7.9;8.5;8.9;9.1;9.5];
Wd = [185;186;183;186;186.5;187;191;192;197;193];
H = [40;52;60;80;100;108;140;160;180;200];
Wd = Wd.*(pi/180);
Ws = Ws;
[U, V] = pol2cart(Wd, Ws);
polar(U, V,'ob');
text(U, V, num2str(H));
%WdXi = flipud((min(WdX):0.1:max(WdX))');
%WsYi = interp1(WdX, WsY, WdXi,'spline' );
%hold on;
%polar(WdXi, WsYi);
t = 1:numel(Ws);
ts = 1:1/numel(Ws):numel(Ws);
xs = pchip(t,U,ts);
ys = pchip(t, V, ts);
hold on;
polar(xs, ys,'r');
end

댓글을 달려면 로그인하십시오.


Nathan Anderson
Nathan Anderson 2018년 3월 10일
편집: Nathan Anderson 2018년 3월 10일
A few subtle changes are required. First, decide on coordinates. Do you want to plot using mathematical conventions (counterclockwise from East), or meteorological (clockwise from North)? Also note that in meteorology, degrees are the direction the wind is blowing FROM. See http://colaweb.gmu.edu/dev/clim301/lectures/wind/wind-uv
On a hodograph, the wind is blowing from the origin to the position on the hodograph, so a 180 degree rotation is required. I'm assuming we chose meteorological winds (so Wd = 185 is from the SSW to NNE), but are confined to the limitations of the polar plot (math direction), which we'll flip later.
Ws = [6.4;6.7;7.4;7.4;7.7;7.9;8.5;8.9;9.1;9.5];
Wd = [185;186;183;186;186.5;187;191;192;197;193];
Wd = Wd-180; % Wind dir on hodograph will be opposite the usual MET convention (blowing from, not to)
H = [40;52;60;80;100;108;140;160;180;200];
Wd = Wd.*(pi/180);
[U, V] = pol2cart(Wd, Ws);
polar(Wd,Ws,'ob'); % Don't use U/V here...they are cartesian.
text(U, V, num2str(H)); % Use U/V here...for text placement.
t = 1:numel(Ws);
ts = 1:1/numel(Ws):numel(Ws);
xs = pchip(t,U,ts);
ys = pchip(t,V,ts);
hold on;
[th,r] = cart2pol(xs,ys); % Need to convert back to polar, here!
polar(th, r,'r');
view([90 -90]) % Correct the view angle, so we see directions as clockwise from North. I'm sure other ways exist, but this was a fudge to get around the fact that "polar" is not too good with met directions.
Enjoy.
  댓글 수: 1
Nathan Anderson
Nathan Anderson 2018년 3월 10일
Who are we kidding? We need more helicity.
Ws = [10;15;15;18;20;25;30;30;30;30];
Wd = [90;130;150;170;190;200;210;230;250;270];

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by