Streamline plot does not make sense
Show older comments
Hi all, I am trying to plot the streamline in matlab, its a wind trajectory involving 2 D wind speed (u and w), on 5 different layers above the water surface. Y axis is the height above water surface and x axis is the phase of the water waves below. The ideal plot should look like the quiver plot on the right hand side, but the streamline plot is very weird, and it did not even cover the whole range of either x or y axis. The starting points of the streamlines are 9 degrees phase at each height. I am not sure if there is anything wrong with the code, please help and thanks so much! Here are the code and the graphs:
close all
clear all
phase_long=[9 27 45 63 81 99 117 135 153 171 189 207 225 243 261 279 297 315 333 351]
startx = ones(1,5)*9;
starty = [.10, .15,.25,.35,.45];
[x,y] = meshgrid(phase_long,starty);
u_with_mean = 5*ones(5,20);
for i = 1:5
w_with_mean(i,:) = 3*(-cos(phase_long));
end
subplot(1,2,2)
h2=quiver(u_with_mean,w_with_mean,0);
yticks([])
xticks([])
set(h2,'AutoScale','on', 'AutoScaleFactor', .5)
subplot(1,2,1)
streamline(x,y,u_with_mean,w_with_mean,startx,starty)
ylim([.05 .50])

Accepted Answer
More Answers (0)
Categories
Find more on Vector Fields in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
