
[Sponsors] 
November 9, 2001, 19:25 
Visualization using Matlab

#1 
Guest
Posts: n/a

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 

November 9, 2001, 23:21 
Re: Visualization using Matlab

#2 
Guest
Posts: n/a

Matlab has enormous online documents for the plotting of quiver(velocity vector), contours and other things.
I have some examples if you need them. 

November 10, 2001, 04:07 
Re: Visualization using Matlab

#3 
Guest
Posts: n/a

Hi
Could you send the matlab examples to me ? Many thanks.. 

November 10, 2001, 07:34 
Re: Visualization using Matlab

#4 
Guest
Posts: n/a

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 

November 10, 2001, 09:13 
Re: Visualization using Matlab

#5 
Guest
Posts: n/a

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 

November 10, 2001, 11:47 
Re: Visualization using Matlab

#6 
Guest
Posts: n/a

would you please email me your examples.
thanks in advance. 

November 10, 2001, 21:08 
Re: Visualization using Matlab

#7 
Guest
Posts: n/a

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


November 10, 2001, 21:21 
Re: Visualization using Matlab

#8 
Guest
Posts: n/a

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 

November 10, 2001, 21:24 
p.s.

#9 
Guest
Posts: n/a

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]; 

November 11, 2001, 09:41 
Re: p.s.

#10 
Guest
Posts: n/a

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 

November 11, 2001, 09:51 
Re: p.s.

#11 
Guest
Posts: n/a

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) 

November 13, 2001, 13:03 
Re: Visualization using Matlab

#12 
Guest
Posts: n/a

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.


November 13, 2001, 15:55 
Re: Visualization using Matlab

#13 
Guest
Posts: n/a

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 

November 29, 2001, 15:15 
Re: Visualization using Matlab

#14 
Guest
Posts: n/a

Hi
Could you send the matlab examples to me ? Many thanks.. 

December 30, 2010, 08:39 

#15 
New Member
Join Date: Dec 2010
Posts: 5
Rep Power: 6 
Hi could you send me the examples, i have no idea where to start
thanks 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
How to start Fluent with Matlab??  Jay Hu  FLUENT  5  October 9, 2013 14:20 
OpenFOAM command from inside MATLAB  sega  OpenFOAM PostProcessing  18  September 25, 2012 07:35 
caling matlab in Fortran  HaKu  Main CFD Forum  0  July 16, 2009 15:35 
2D Euler Solver for compressible flow in Matlab  Volkan  Main CFD Forum  1  October 28, 2007 01:40 
visualization with matlab  lola  Main CFD Forum  1  October 18, 2005 03:22 