1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Matlab plotting please help

  1. Apr 21, 2010 #1
    ψ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
     
  2. jcsd
  3. Apr 21, 2010 #2

    Mark44

    Staff: Mentor

    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.
     
  4. Apr 21, 2010 #3
    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 5


    y =

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

    ??? Error using ==> mtimes
    Inner matrix dimensions must agree.



    i cant draw it why??
     
    Last edited: Apr 21, 2010
  5. May 17, 2011 #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
     
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook