Plot Stream Lines Using Matlab: ψ4 + ψ2 U2(x2-y2+a2) = U4x2y2

  • Thread starter Thread starter kingjames
  • Start date Start date
  • Tags Tags
    Matlab Plotting
Click For Summary

Discussion Overview

The discussion revolves around plotting streamlines using MATLAB based on a specific stream function equation related to flow along a vertical plate. Participants are exploring the necessary MATLAB code and addressing issues encountered during the plotting process.

Discussion Character

  • Technical explanation
  • Homework-related
  • Mathematical reasoning

Main Points Raised

  • One participant presents the stream function equation and requests assistance in plotting streamlines using MATLAB.
  • Another participant offers to help with MATLAB code but clarifies that they will not write the code for the requester.
  • A participant describes their approach of finding the roots of the equation and calculating derivatives to facilitate plotting.
  • The participant shares a specific MATLAB command for solving the equation but encounters an error related to matrix dimensions when attempting to plot.
  • Another participant identifies the error message and suggests that the issue arises from not meshing the data correctly and missing necessary dot operators in the equations.
  • This participant provides guidance on how to mesh the data and emphasizes the importance of using element-wise operations in MATLAB.

Areas of Agreement / Disagreement

Participants generally agree on the need for MATLAB code to plot the streamlines, but there are differing views on the specific implementation details and the source of the encountered errors. The discussion remains unresolved regarding the exact corrections needed for the code.

Contextual Notes

Participants have not fully resolved the mathematical steps required for plotting, and there are indications of missing assumptions or details in the code that could affect the outcome.

kingjames
Messages
2
Reaction score
0
ψ4 + ψ2 U2(x2-y2+a2) = U4x2y2

This is the stream line equation of a flow along a vertical plate!
i need to plot the stream lines using matlab! ψ is the stream function
U is constant and 'a' is the plate length
 
Physics news on Phys.org
kingjames said:
ψ4 + ψ2 U2(x2-y2+a2) = U4x2y2

This is the stream line equation of a flow along a vertical plate!
i need to plot the stream lines using matlab! ψ is the stream function
U is constant and 'a' is the plate length
Write some MATLAB code for these calculations and we'll help you with it, but we're not going to write the code for you.
 
Mark44 said:
Write some MATLAB code for these calculations and we'll help you with it, but we're not going to write the code for you.

i tried to find the roots of the equation then i have to find the derivatives with respect to x and y to be able to draw them

solve ('z^4+z^2*UINF^2*(x^2-y^2+a^2)-(UINF^4*x^2*y^2)=0','z')

ans =

1/2*(2*(x^4+2*x^2*y^2+2*x^2*a^2+y^4-2*y^2*a^2+a^4)^(1/2)-2*x^2+2*y^2-2*a^2)^(1/2)*UINF
-1/2*(2*(x^4+2*x^2*y^2+2*x^2*a^2+y^4-2*y^2*a^2+a^4)^(1/2)-2*x^2+2*y^2-2*a^2)^(1/2)*UINF
1/2*(-2*(x^4+2*x^2*y^2+2*x^2*a^2+y^4-2*y^2*a^2+a^4)^(1/2)-2*x^2+2*y^2-2*a^2)^(1/2)*UINF
-1/2*(-2*(x^4+2*x^2*y^2+2*x^2*a^2+y^4-2*y^2*a^2+a^4)^(1/2)-2*x^2+2*y^2-2*a^2)^(1/2)*UINF

one of the deravites is the folowwing (s)
x=-5:1:5
y=-5:1:5
s=1/4/(-2*(x.^4+2*x.^2*y.^2+2*x.^2*a.^2+y.^4-2*y.^2*a.^2+a.^4).^(1/2)-2*x.^2+2*y.^2-2*a.^2).^(1/2)*UINF*(-1/(x.^4+2*x.^2*y.^2+2*x.^2*a.^2+y.^4-2*y.^2*a.^2+a.^4).^(1/2)*(4*x.^2*y+4*y.^3-4*y*a.^2)+4*y)
a=1
UINF=1
plot(x,y,s)

x =

-5 -4 -3 -2 -1 0 1 2 3 4 5y =

-5 -4 -3 -2 -1 0 1 2 3 4 5

? Error using ==> mtimes
Inner matrix dimensions must agree.
i can't draw it why??
 
Last edited:
If you follow the message given by MATLAB , YOU SEE THIS:

? Error using ==> mtimes
Inner matrix dimensions must agree. HERE BECAUSE YOU FORGET A DOTE OR SOMETHING
You have missed to mesh you data
Matlab does not recognise a paire of data without this code
[x,y]=mesh(x=data, y=data) for example [x,y]=mesh(x=0:1:10, y=0:1:10) this should be written before the equations;
Also you have missed something in the equation that will plot your graph
for, example you x and y are varying and you devided 1/ by the rest of the equation you nedd to this ( 1./equation in your equation you missed the dote ) don't forget the dote after 1
Try this. I think this will help you to solve your problem, GOOD LUCK
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 14 ·
Replies
14
Views
9K