Help with finite difference for matlab

In summary, the conversation discusses using the finite difference method in Matlab to solve for Phi, which is equal to Phi_infinity minus Phi_t. Phi_infinity is defined as 1 - e^2 and Phi_t is equal to the product of A(t) and B(e). The values of A and B are determined by differential equations, with A having a differential of dA/dt = -c^2*A and B having a differential of 1/e * d/dt(e*dB/dt) = -c^2*B. The separation constant e is also introduced. The problem at hand involves solving the Fourier equation in one dimension with a boundary condition of zero at t=0 and Dirichlet boundary conditions at e
  • #1
lohanlotter
7
0
I have a question which states that I have to solve Phi using the finite difference method in matlab.

Phi = Phi_infinity - Phi_t

where Phi_infinity = 1 - e^2

and Phi_t = A(t).B(e)

A has the differential for dA/dt = -c^2. A
and B 1/e.d/de(edB/de)=-c^2.B

where e is a separation constant.

I know the boundary and initial condition
at t = 0 Phi = 0
at e = 0 Phi = 1
at e = 1 Phi = 0

Please help I don't know where to start
 
Physics news on Phys.org
  • #2
What was the original problem? Separation of variables in order to solve the Fourier equation in one dimension? Initial condition of zero everywhere in domain. Then Dirichlet boundary condition at one end to cause the transcience?
 

1. What is finite difference in Matlab?

Finite difference in Matlab is a numerical method for solving differential equations. It approximates the derivatives of a function at a given point by using the function values at nearby points. This method is commonly used in scientific and engineering applications.

2. How do I implement finite difference in Matlab?

To implement finite difference in Matlab, you first need to define the function and its initial conditions. Then, you can use the built-in functions such as diff, gradient or del2 to compute the derivatives at each point. Finally, you can use a loop or vectorization to calculate the function values at each point using the finite difference formula.

3. What are the advantages of using finite difference in Matlab?

One advantage of using finite difference in Matlab is that it can handle a wide range of differential equations, including both ordinary and partial differential equations. It is also relatively easy to implement and can provide accurate solutions in a timely manner. Additionally, Matlab has a variety of built-in functions that can make the implementation process more efficient.

4. Are there any limitations to using finite difference in Matlab?

One limitation of using finite difference in Matlab is that it can be computationally intensive for complex problems with a large number of points. It also requires careful selection of the step size and boundary conditions to ensure accurate solutions. Additionally, it may not be suitable for problems with discontinuities or sharp changes in the function.

5. Can I visualize the results of finite difference in Matlab?

Yes, you can visualize the results of finite difference in Matlab by using the plot or surf functions. These functions can create 2D or 3D plots of the function values at each point, allowing you to visualize the behavior of the solution over time or in different regions. You can also use other visualization tools in Matlab to further analyze and interpret the results.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
5
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
18
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
724
  • Engineering and Comp Sci Homework Help
Replies
2
Views
823
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
806
  • Engineering and Comp Sci Homework Help
Replies
1
Views
938
  • Engineering and Comp Sci Homework Help
Replies
1
Views
877
  • Engineering and Comp Sci Homework Help
Replies
6
Views
2K
Back
Top