1. Not finding help here? Sign up for a free 30min 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!

Solving a fourth order PDE by finite difference method by matlab

  1. May 8, 2010 #1
    1. The problem statement, all variables and given/known data

    how can i solve this problem by MATLAB?
    pls help me

    A (d4y/dx4) - B(d2y/dt2) = Cy

    A=E*I

    B=p*sin(w*t)

    c=p*w2




    conditions are

    1.at x=0, dy/dx=0

    2.at x=0,y=0

    3.at x=L d2y/dx2=0

    4. at x=L d3y/dx3=p (p is a function of t here)

    x=0 and x=L are the two boundaries

    pls tell me how can i slove it in MATLAB


    2. Relevant equations

    conditions are

    1.at x=0, dy/dx=0

    2.at x=0,y=0

    3.at x=L d2y/dx2=0

    4. at x=L d3y/dx3=p (p is a function of t here)

    x=0 and x=L are the two boundaries


    3. The attempt at a solution

    i tried to solve it this way but not sure wheather it was right

    .................................................................................

    format long;
    clc;
    clear all;
    m=10;
    n=100;
    l=.5;
    time=input('t = ');
    h=l/m;
    k=time/n;
    z=h/k;
    r=m-1;
    d=.05;
    w=.1;
    q=1;
    p=1000;
    E=207e9;
    I=(3.1416*d^4)/64;

    tt=[k:k:time];

    T=(p*sin(w*tt(1,:)))*(1/k^2);
    A=E*I*k^2/h^4;
    C=p*w^2*k^2;

    a=zeros(n*r);
    b=zeros(n*r,1);
    b(:,1)=q;

    i=1;t=1;

    for e=1:r
    if i==1
    a(e,i)=A-C;
    a(e,i+1)=-4*A;
    a(e,i+2)=6*A;
    a(e,i+3)=-4*A;
    a(e,i+4)=A;

    a(e,r+i)=-T(t);
    a(e,2*r+i)=2*T(t);
    a(e,3*r+i)=-T(t);
    elseif i==r
    a(e,i)=A-C;
    a(e,i-1)=-4*A;
    a(e,i-2)=6*A;
    a(e,i-3)=-4*A;
    a(e,i-4)=A;

    a(e,r+i)=-T(t);
    a(e,2*r+i)=2*T(t);
    a(e,3*r+i)=T(t);
    else
    a(e,i)=6*A-C;
    a(e,i+1)=-4*A;
    if (i+2)<=r
    a(e,i+2)=A;
    end
    a(e,i-1)=-4*A;
    if (i-2)>0
    a(e,i-2)=A;
    end
    a(e,r+i)=-T(t);
    a(e,2*r+i)=2*T(t);
    a(e,3*r+i)=-T(t);
    end
    i=i+1;
    end

    s=0;i=1;t=2;

    for e=(r+1):((n*r)-r)
    if i==1
    a(e,(t-1)*r+i)=A+2*T(t)-C;
    a(e,(t-1)*r+i+1)= -4*A;
    a(e,(t-1)*r+i+2)= 6*A;
    a(e,(t-1)*r+i+3)= -4*A;
    a(e,(t-1)*r+i+4)=A;
    a(e,t*r+i)=-T(t);
    a(e,(t-2)*r+i)=-T(t);
    elseif i==r
    a(e,(t-1)*r+i)=A-C+2*T(t);
    a(e,(t-1)*r+i-1)= -4*A;
    a(e,(t-1)*r+i-2)= 6*A;
    a(e,(t-1)*r+i-3)= -4*A;
    a(e,(t-1)*r+i-4)=A;

    a(e,t*r+i)=-T(t);
    a(e,(t-2)*r+i)=-T(t);
    else
    a(e,(t-1)*r+i)=6*A+2*T(t)-C;
    a(e,(t-1)*r+i+1)=-4*A;
    if (i+2)<=r
    a(e,(t-1)*r+i+2)=A;
    end
    a(e,(t-1)*r+i-1)=-4*A;
    if (i-2)>0
    a(e,(t-1)*r+(i-2))=A;
    end
    a(e,(t*r)+i)=-T(t);
    a(e,(t-2)*r+i)=T(t);
    end
    s=s+1;
    if s==r
    t=t+1;
    s=0;
    i=1;
    else
    i=i+1;
    end
    end

    i=1;t=n;
    for e=(n*r-r)+1:(n*r)
    if i==1
    a(e,(t-1)*r+i)=A-C;
    a(e,(t-1)*r+i+1)= -4*A;
    a(e,(t-1)*r+i+2)= 6*A;
    a(e,(t-1)*r+i+3)= -4*A;
    a(e,(t-1)*r+i+4)=A;

    a(e,(t-2)*r+i)=-T(t);
    a(e,(t-3)*r+i)=2*T(t);
    a(e,(t-4)*r+i)=-T(t);

    elseif i==r
    a(e,(t-1)*r+i)=A-C;
    a(e,(t-1)*r+i-1)= -4*A;
    a(e,(t-1)*r+i-2)= 6*A;
    a(e,(t-1)*r+i-3)= -4*A;
    a(e,(t-1)*r+i-4)=A;

    a(e,(t-2)*r+i)=-T(t);
    a(e,(t-3)*r+i)=2*T(t);
    a(e,(t-4)*r+i)=-T(t);
    else
    a(e,(t-1)*r+i)=6*A;
    a(e,(t-1)*r+i+1)=-4*A;
    if (i+2)<=r
    a(e,(t-1)*r+i+2)=A-C;
    end
    a(e,(t-1)*r+i-1)=-4*A;
    if (i-2)>0
    a(e,(t-1)*r+(i-2))=A;
    end
    a(e,(t-2)*r+i)=-T(t);
    a(e,(t-3)*r+i)=2*T(t);
    a(e,(t-4)*r+i)=-T(t);
    end
    i=i+1;
    end

    x=a\b;

    v=zeros(n,r);
    y=1;
    for i=1:r
    for j=1:n
    v(i,j)=x(y);
    y=y+1;
    end
    end
    v;
    %plot(v)
    plot(rot90(v))

    .............................................................
    i could use only two conditions

    1.at x=0, dy/dx=0

    2.at x=0,y=0

    seeking your advice
    1. The problem statement, all variables and given/known data



    2. Relevant equations



    3. The attempt at a solution
    1. The problem statement, all variables and given/known data



    2. Relevant equations



    3. The attempt at a solution
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?



Similar Discussions: Solving a fourth order PDE by finite difference method by matlab
  1. Finite Differences (Replies: 0)

Loading...