MATLAB Answers

Plotting a Figure for Velocity/Temperature as One moves along a 'radial line' in steps of 0.2

8 views (last 30 days)
Tom
Tom on 10 Aug 2019
Edited: Agnish Dutta on 5 Feb 2020 at 10:21
I have results for velocity and temperature due to a flow when you choose fix theta and phi in spherical polar coordinates and move out in the radial direction at steps of 0.2 at a time, so that the radial coordinate goes from 1 to 10 in steps of 0.2.
Basically the result that you get is a 4 x 46 array, so that's 46 column vectors where the components are thought of as [v1, v2, v3, theta], so you have 46 column vectors giving the velocity vector and temperature at each position on the radial line (the velocity vector is in Cartesian coordinates however).
I need to plot separate graphs where I take the radial component of the velocity, the polar component of the velocity and the temperature and then plot against radius if that makes sense. So there will be a black circle on the plot at r = 1 for the radial component of the velocity in the first vector in the array, then at r = 1.2 another dot for the radial component of the velocity of the second vector in the array, and so on. Please let me know if my intention is not clear.

  3 Comments

dpb
dpb on 10 Aug 2019
Not entirely clear, no.... :)
Can you make a sketch of what you think this would look like and attach it?
Also, we can't do much with the data; attach a .mat file or just the text for no bigger array than this (presuming don't keep 2000 digits of precision for each).
Tom
Tom on 11 Aug 2019
I am basically trying to reproduce the numerical results on Figure 6, page 429 of this paper.
So you see there are dots on the line corresponding to the numerical solution at various radii as you fix theta and phi and move outwards. What I am going for to is to have a dot at each step of 0.2 in the radius as you go from 1 to 1.2 and so on up to 10.
Now I've got the position vectors in a 3 x 46 array for all those radial points and I've got the 4 x 46 array which gives the velocity vector and the temperature at each point, and I just want to take each vector and plot the temperature on a graph against radius to match with the analytic solution, plus the radial component of the velocity and the polar component.
I've already got the graph of r against polar component to plot the analytic solution, so it would be sufficient to just take the first vector, find the polar component of velocity, plot it on graph and have it correspond to r = 1, then take the second vector, do the same, plot it on the graph and line it up with r = 1.2, then continue although all the points are on there.
Agnish Dutta
Agnish Dutta on 5 Feb 2020 at 10:16
From what I understand, you would like to plot multiple lines with dots at fixed intervals on the same graph. The following command will plot a dotted curve:
>> plot(x_data, y_data, '.-');
You can then use "hold on" and "hold off" to plot additional curves on the same graph. Please refer to the following documentation link for more details regarding the same:
Retain current plots while adding more: https://www.mathworks.com/help/matlab/ref/hold.html
The above suggestions will worlk provided you know what exactly you would like to plot and in what format your data is in. Further investigation into this would require a more lucid explanation of the issue from your end.
Please feel free to revert to this thread in case you need further assistance.

Sign in to comment.

Answers (0)

Sign in to answer this question.

Products


Translated by