Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

Plot streamlines in matlab

Please login with a confirmed email address before reporting spam

Hi All,

Does anybody know how to extract velocity field (e.g. laminar flow) and plot streamlines in matlab? I am still playing but no luck so far.

Thanks,
Danial

2 Replies Last Post 16 ago 2010, 10:36 GMT-4

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 23 lug 2010, 16:35 GMT-4
Hi Danial,

I have had luck using the following approach (4.0), though there may be better ways to go about it:

1. Use mpheval command to obtain grid point coordinates and corresponding velocities
2. Use meshgrid command to create regular coordinate grid for plotting
3. Use TriScatteredInterp command to obtain velocities at coordinates generated by meshgrid command
4. Use streamline command to generate and plot streamlines

A little clunky, but it seems to work. If you come up with a better approach, please let me know.

Paul
Hi Danial, I have had luck using the following approach (4.0), though there may be better ways to go about it: 1. Use mpheval command to obtain grid point coordinates and corresponding velocities 2. Use meshgrid command to create regular coordinate grid for plotting 3. Use TriScatteredInterp command to obtain velocities at coordinates generated by meshgrid command 4. Use streamline command to generate and plot streamlines A little clunky, but it seems to work. If you come up with a better approach, please let me know. Paul

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 16 ago 2010, 10:36 GMT-4

Hi Danial,

I have had luck using the following approach (4.0), though there may be better ways to go about it:

1. Use mpheval command to obtain grid point coordinates and corresponding velocities
2. Use meshgrid command to create regular coordinate grid for plotting
3. Use TriScatteredInterp command to obtain velocities at coordinates generated by meshgrid command
4. Use streamline command to generate and plot streamlines

A little clunky, but it seems to work. If you come up with a better approach, please let me know.

Paul


Hi Paul,

Do you have a code snippet I can check? That will save a lot of time debugging.

Best,
Danial
[QUOTE] Hi Danial, I have had luck using the following approach (4.0), though there may be better ways to go about it: 1. Use mpheval command to obtain grid point coordinates and corresponding velocities 2. Use meshgrid command to create regular coordinate grid for plotting 3. Use TriScatteredInterp command to obtain velocities at coordinates generated by meshgrid command 4. Use streamline command to generate and plot streamlines A little clunky, but it seems to work. If you come up with a better approach, please let me know. Paul [/QUOTE] Hi Paul, Do you have a code snippet I can check? That will save a lot of time debugging. Best, Danial

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.