Visualization using Matlab
Hi,
I have just started using Matlab as a tool for plotting results generated by a CFD code written in Fortran. May I know if anyone has scripts for generating contour plots of quantities like Mach number, pressure and so on? Please advice as to how the external data file generated by the CFD code should structure the flow quantities. Thanks very much, Chan K I 
Re: Visualization using Matlab
Matlab has enormous online documents for the plotting of quiver(velocity vector), contours and other things.
I have some examples if you need them. 
Re: Visualization using Matlab
Hi
Could you send the matlab examples to me ? Many thanks.. 
Re: Visualization using Matlab
You can use help command at matlab, type
>> help contour CONTOUR Contour plot. CONTOUR(Z) is a contour plot of matrix Z treating the values in Z as heights above a plane. A contour plot are the level curves of Z for some values V. The values V are chosen automatically. CONTOUR(X,Y,Z) X and Y specify the (x,y) coordinates of the surface as for SURF. CONTOUR(Z,N) and CONTOUR(X,Y,Z,N) draw N contour lines, overriding the automatic value. CONTOUR(Z,V) and CONTOUR(X,Y,Z,V) draw LENGTH(V) contour lines at the values specified in vector V. Use CONTOUR(Z,[v v]) or CONTOUR(X,Y,Z,[v v]) to compute a single contour at the level v. [C,H] = CONTOUR(...) returns contour matrix C as described in CONTOURC and a column vector H of handles to LINE or PATCH objects, one handle per line. Both of these can be used as input to CLABEL. The UserData property of each object contains the height value for each contour. The contours are normally colored based on the current colormap and are drawn as PATCH objects. You can override this behavior with the syntax CONTOUR(...,'LINESPEC') to draw the contours as LINE objects with the color and linetype specified. Uses code by R. Pawlowicz to handle parametric surfaces and inline contour labels. Example: [c,h] = contour(peaks); clabel(c,h), colorbar See also CONTOUR3, CONTOURF, CLABEL, COLORBAR. If you want to know more details, just ask me. Junseok 
Re: Visualization using Matlab
Hi,
Thanks very much for the advice. Paul: Would it be OK to send me examples of Matlab contour plotting? Suppose I had a 3D Hgrid of turbomachinery blade passage, does Matlab have any features to plot and visualize the grid? Regards 
Re: Visualization using Matlab
would you please email me your examples.
thanks in advance. 
Re: Visualization using Matlab
dear Kim, how do we plot the velocity vetors for, let's say, a two dimensional plot, given the x and y of the velocity components are known? if these data is in text file, then, is it possible to import them into matlab? thanks. regards, yfyap

Re: Visualization using Matlab
Okay, first of all, you can check quiver command at matlab.
>> help quiver And about the your question, you can save velocity files such as u and v, for example, save u velocity field in a file name u.m and file content is A=[1 2 3 4 5 6 7 8 9]; and in another file, say v.m put contents like this B=[1 3 2 5 7 6 7 9 8]; Then, surely these files are on the working directory. There are two ways which you can import these data by typing :> u and then >> v then you can check they are loaded or not by typing >> whos you will see >> u :> v :> whos Name Size Bytes Class A 3x3 72 double array B 3x3 72 double array Grand total is 18 elements using 144 bytes Now use quiver command, like this >> quiver(A,B) And the other way is make another file, and put above commands in that file, and run that file. Junseok 
p.s.
A=[1 2 3 4 5 6 7 8 9]; B=[1 3 2 5 7 6 7 9 8];
These should be A=[1 2 3; 4 5 6; 7 8 9]; B=[1 3 2; 5 7 6; 7 9 8]; 
Re: p.s.
thanks a lot, got the plot already. for contour plot, i have tried the following, but the contour line won't appear. note z is the height
: x=[ elements of x] y=[ elements of y] z=[ elements of z] contour(x,y,z) thanks agian. regards, yfyap 
Re: p.s.
The basic idea is you should use matrix not vector for height z on x and y coordinate,
clear x=[1 2 3 4 5]; y=[1 2 3 4 5]; z=[5 2 3 8 9; 1 3 4 12 4;8 8 6 5 5; 6 98 5 8 9; 86 0 75 98 7]; contour(x,y,z) and try contourf, it is cool. contourf(x,y,z) 
Re: Visualization using Matlab
I 've developed a code for solving 3 D free convection in box and written in fortran. Three dimensional plotting (temperature, pressure and velocity vectors) are generated by using Matlab. If you're interested, I'll send you my codes (*.for & *.m) for you.

Re: Visualization using Matlab
Hi Pran,
Yes, I'm interested in your codes. May I have a copy of the fortran and matlab codes? Thanks very much, Chan K I 
Re: Visualization using Matlab
Hi
Could you send the matlab examples to me ? Many thanks.. 
Hi could you send me the examples, i have no idea where to start
thanks 
All times are GMT 4. The time now is 14:06. 