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

In summary, the conversation discusses the stream line equation of a flow along a vertical plate and the need to plot the stream lines using MATLAB. It also mentions the use of the stream function ψ, constant U, and plate length 'a'. The conversation also mentions the need for MATLAB code to perform the calculations, and provides an example of code to find the roots and derivatives of the equation. A suggestion is also given to mesh the data before plotting the graph and to add a dot after 1 in the equation.
  • #1
kingjames
3
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
  • #2
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.
 
  • #3
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:
  • #4
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
 
  • #5


I would first clarify the context and assumptions of the problem. Is this a two-dimensional or three-dimensional flow? Is the flow steady or unsteady? What is the physical significance of the stream function and the constant U? Once these details are established, I would approach the problem by first defining the variables and constants in Matlab. Then, I would use the built-in functions for plotting stream lines, such as "streamslice" or "streamline," to visualize the flow pattern described by the equation. It may also be helpful to plot the velocity field using the "quiver" function to better understand the behavior of the flow. Additionally, I would consider varying the value of the constant U and the plate length 'a' to investigate their effects on the stream lines. Overall, using Matlab's powerful visualization tools, I would be able to create a clear and informative plot of the stream lines described by this equation.
 

1. What is the purpose of plotting stream lines using Matlab?

The purpose of plotting stream lines using Matlab is to visually represent the flow or movement of a vector field. This can help in understanding the behavior of a system or in analyzing fluid flow patterns.

2. What is the meaning of the equation ψ4 + ψ2 U2(x2-y2+a2) = U4x2y2?

This equation represents the stream function of a 2D flow field, where ψ (psi) is the stream function, U is the velocity, and x and y are the coordinates of the flow. The values of ψ and U are dependent on the values of x and y, and the constant a represents the displacement of the flow field.

3. How do you input this equation into Matlab to plot stream lines?

To plot stream lines using this equation in Matlab, you would first define the variables and constants, and then use the "contour" or "quiver" function to plot the stream lines based on the values of the variables and constants.

4. What does the shape and direction of the stream lines indicate?

The shape and direction of the stream lines indicate the direction and strength of the flow at different points in the field. The stream lines are perpendicular to the direction of the flow and the spacing between them represents the speed of the flow.

5. Can this equation be used for any type of flow field?

No, this equation is specifically for 2D flow fields. For other types of flow fields, different equations and methods may be used to plot stream lines using Matlab.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
10
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
7K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
14
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
Back
Top