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
AI Thread Summary
The discussion focuses on plotting streamlines for the equation ψ4 + ψ2 U2(x2-y2+a2) = U4x2y2, which describes flow along a vertical plate. Participants emphasize the need to write MATLAB code for calculations and plotting, while also providing guidance on finding roots and derivatives of the equation. A user encounters an error related to matrix dimensions when attempting to plot, leading to suggestions about using mesh grids and ensuring proper element-wise operations in MATLAB. The importance of including dots in operations to avoid errors is highlighted, along with the need to define x and y as mesh grids before plotting. The conversation concludes with encouragement to resolve the plotting issue using the provided advice.
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
Views
2K
Replies
10
Views
2K
Replies
5
Views
2K
Replies
1
Views
2K
Replies
1
Views
3K
Replies
1
Views
2K
Replies
1
Views
2K
Replies
1
Views
3K
Replies
7
Views
2K
Back
Top