Solving a fourth order PDE by finite difference method by matlab

In summary: This will give you the solution for y and its first two derivatives at every point between x=0 and x=L. You can then plot the solution or use it for further calculations. In summary, to solve this problem using MATLAB, you need to define the differential equation, set up the boundary conditions, and use MATLAB's ode45 function to solve the equation numerically.
  • #1
tanma_amnat
3
0

Homework Statement



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


Homework 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


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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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

 
Physics news on Phys.org
  • #2
.The Attempt at a SolutionYou can use MATLAB's numerical integration functions to solve this problem. First, you need to create a function that describes the differential equation:function dydx = diffeq(x,y,A,B,C)dydx = [A*(d4y/dx4)-B*(d2y/dt2)];endThen, you need to set up the boundary conditions, which are given in the problem statement: x0 = 0; % Boundary condition at x=0y0 = 0; % Boundary condition at x=0xL = L; % Boundary condition at x=Ld2y_xL = 0; % Boundary condition at x=Ld3y_xL = p; % Boundary condition at x=LFinally, you can use MATLAB's ode45 function to solve the differential equation numerically: [x,y] = ode45(@(x,y) diffeq(x,y,A,B,C), [x0 xL], [y0 d2y_xL d3y_xL]);
 

1. What is a fourth order PDE?

A fourth order partial differential equation (PDE) is a mathematical equation that involves partial derivatives of a function with respect to multiple independent variables, up to the fourth order. It is commonly used to model physical phenomena such as heat transfer, fluid dynamics, and electromagnetic fields.

2. How is the finite difference method used to solve fourth order PDEs?

The finite difference method is a numerical technique for solving differential equations. In this method, the continuous domain of the PDE is discretized into a finite number of points, and the derivatives are approximated using the values at these points. This results in a system of algebraic equations that can be solved using numerical methods, such as Matlab.

3. What are the advantages of using the finite difference method to solve fourth order PDEs?

The finite difference method is relatively easy to implement and can handle complex geometries and boundary conditions. It also provides accurate solutions with a high level of precision. Additionally, it is computationally efficient and can handle large systems of equations.

4. What are the limitations of using the finite difference method to solve fourth order PDEs?

The finite difference method can only approximate continuous functions, so the accuracy of the solution depends on the chosen grid size. Also, it cannot handle PDEs with mixed boundary conditions, and the discretization process can be time-consuming for complex problems.

5. What is the role of Matlab in solving fourth order PDEs using the finite difference method?

Matlab is a powerful software for numerical computing, making it a popular choice for solving PDEs using the finite difference method. It provides built-in functions for solving systems of equations, as well as tools for plotting and visualizing the results. It also allows for easy implementation of various boundary conditions and can handle large matrices efficiently.

Similar threads

  • Calculus and Beyond Homework Help
Replies
2
Views
114
  • Calculus and Beyond Homework Help
Replies
3
Views
323
  • Calculus and Beyond Homework Help
Replies
1
Views
437
  • Calculus and Beyond Homework Help
Replies
4
Views
493
  • Calculus and Beyond Homework Help
Replies
16
Views
558
  • Calculus and Beyond Homework Help
Replies
1
Views
702
  • Calculus and Beyond Homework Help
Replies
2
Views
148
  • Calculus and Beyond Homework Help
Replies
6
Views
289
  • Calculus and Beyond Homework Help
Replies
1
Views
532
  • Calculus and Beyond Homework Help
Replies
3
Views
410
Back
Top