CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Main CFD Forum

Visualization using Matlab

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   November 9, 2001, 19:25
Default Visualization using Matlab
  #1
Chan Keen Ian
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
  Reply With Quote

Old   November 9, 2001, 23:21
Default Re: Visualization using Matlab
  #2
Paul
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.

  Reply With Quote

Old   November 10, 2001, 04:07
Default Re: Visualization using Matlab
  #3
ryan
Guest
 
Posts: n/a
Hi

Could you send the matlab examples to me ?

Many thanks..
  Reply With Quote

Old   November 10, 2001, 07:34
Default Re: Visualization using Matlab
  #4
Junseok Kim
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

  Reply With Quote

Old   November 10, 2001, 09:13
Default Re: Visualization using Matlab
  #5
Chan Keen Ian
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 3-D H-grid of turbomachinery blade passage, does Matlab have any features to plot and visualize the grid?

Regards
  Reply With Quote

Old   November 10, 2001, 11:47
Default Re: Visualization using Matlab
  #6
dia
Guest
 
Posts: n/a
would you please e-mail me your examples.

thanks in advance.
  Reply With Quote

Old   November 10, 2001, 21:08
Default Re: Visualization using Matlab
  #7
yfyap
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
  Reply With Quote

Old   November 10, 2001, 21:21
Default Re: Visualization using Matlab
  #8
Junseok Kim
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

  Reply With Quote

Old   November 10, 2001, 21:24
Default p.s.
  #9
Junseok Kim
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];
  Reply With Quote

Old   November 11, 2001, 09:41
Default Re: p.s.
  #10
yfyap
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
  Reply With Quote

Old   November 11, 2001, 09:51
Default Re: p.s.
  #11
Junseok Kim
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)
  Reply With Quote

Old   November 13, 2001, 13:03
Default Re: Visualization using Matlab
  #12
pran
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.
  Reply With Quote

Old   November 13, 2001, 15:55
Default Re: Visualization using Matlab
  #13
Chan Keen Ian
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
  Reply With Quote

Old   November 29, 2001, 15:15
Default Re: Visualization using Matlab
  #14
Nassar
Guest
 
Posts: n/a
Hi

Could you send the matlab examples to me ?

Many thanks..
  Reply With Quote

Old   December 30, 2010, 08:39
Default
  #15
New Member
 
Join Date: Dec 2010
Posts: 5
Rep Power: 6
sixfor is on a distinguished road
Hi could you send me the examples, i have no idea where to start

thanks
sixfor is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


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 Post-Processing 18 September 25, 2012 07:35
caling matlab in Fortran HaKu Main CFD Forum 0 July 16, 2009 15:35
2-D 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


All times are GMT -4. The time now is 20:15.