MATLAB Answers

1

How do i plot multiple velocity profiles in one figure?

Asked by Karl Johan Josefsson on 21 Feb 2015
Latest activity Answered by Orides Golyjeswski on 23 Aug 2018
Hi, i need to construct a plot or a figure containing the velocity profiles on a simulated body. The figure should contain profiles for different locations along the body.
much like this picture to the left.
I have tried the streamline commant but i can't seem to understand it and quiver commant plots arrows, which i don't want. Can anyone please help me?
I need help or hints on how to construct a code for this where the velocity vector u can be plotted for the coordinates x1,y1 x2,y2 and x3,y3 compared to exerimental data data u_real. Here is my code.
clear all
%velocities
u=[36 38 40 41 41 42 44 44 45 46 47 48 48 48 49 49 48 48 47 47];
u_real=[36.411 38.774 40.375 41.617 42.741 44.298 45.544 46.647 47.543 48.122...
48.385 48.2 48.3 48.246 48.441 48.394 48.365 48.147 47.798 47.207];
v=zeros(1,20);
v_real=v;
%coordinates
x1=zeros(1,20);
x2=5*ones(1,20);
x3=10*ones(1,20);
y1=(0:1:20);
y2=(-2:1:18);
y3=(-5:1:15);
On the x-axis is the x coordinate y axis is the y coordinates for each velocity.
Hope someone knows a solution to my problem. Thanks, KJ

  0 Comments

Sign in to comment.

2 Answers

Answer by Orides Golyjeswski on 23 Aug 2018

I had a similar problem and I'll show you my solution to it.
I needed to create something very similar to this figure:
(Source: Jovic, Srba & M. Driver, David. (1994). Backward-facing step measurements at low Reynolds number, Re (sub h)= 5000. NASA Technical Memorandum 108807.)
So I have a velocity profile for x = 4, 6, 10, 15 and 19... two vectors with y coordinates and u(y) velocities at those x positions.
I just made the translation of the vector velocity by a constant (4, 6, 10, 15 and 19) and worked with xticks and xticklabels functions.
p1 = plot(v_4 + 0 , y_4 ,'r', 'linewidth', 2); hold on; %grid on
p2 = plot(v_6 + 6 , y_6 ,'g', 'linewidth', 2);
p3 = plot(v_10 + 10, y_10,'b', 'linewidth', 2);
p4 = plot(v_15 + 15, y_15,'k', 'linewidth', 2);
p5 = plot(v_19 + 19, y_19,'m', 'linewidth', 2);
ylabel('y/h');
xticks([0 6 10 15 19]);
%xticklabels({'x = 4','x = 6','x = 10','x = 15','x = 19'});
%xticklabels({'0','0','0','0','0'});
annotation('textbox',[.37 .3 .6 .6],'String','4' ,'FitBoxToText','on', 'LineStyle','none');
annotation('textbox',[.52 .3 .6 .6],'String','6' ,'FitBoxToText','on', 'LineStyle','none');
annotation('textbox',[.60 .3 .6 .6],'String','10','FitBoxToText','on', 'LineStyle','none');
annotation('textbox',[.73 .3 .6 .6],'String','15','FitBoxToText','on', 'LineStyle','none');
annotation('textbox',[.83 .3 .6 .6],'String','19','FitBoxToText','on', 'LineStyle','none');
the code above creates this figure

  0 Comments

Sign in to comment.


Answer by Pjotr Muis on 24 Oct 2017

Same problem here. How do you divide the x-axis into multiple blocks and use the upper axis as velocity component for every block?

  0 Comments

Sign in to comment.