Troubleshooting PDEs in MATLAB: Why is My Function Not Affecting the Plot?

In summary, the conversation discusses the issue of MATLAB not recompiling a function even when changes are made. The solution is to remove the compiled files from the directory and force MATLAB to recompile a new version. The conversation also mentions that this issue may occur when the files are on a network drive.
  • #1
member 428835
Hi PF!

I am trying to solve a pde in MATLAB and started by using the generic code mathwork supplies and then augmenting for my purpose. After defining the function below and run the script, i can do anything to the ##f## and nothing changes. I can literally delete the line and still I receive the same plot. Any idea why?
Code:
function [c,f,s] = pdex1pde(x,t,u,DuDx)
c = 1;
f = DuDx;%pdedu/dx
s = u;
 
Physics news on Phys.org
  • #2
Sometimes when MATLAB compiles a function, it saves the compilation and will not recompile unless it knows the function has changed. Sometimes this goes wrong. I have had to remove compiled files from the directory to force MATLAB to recompile a new version. I forget what extension the compiled file had. I remember that I had a lot of problems when the files were on a network drive. Sometimes modification dates on network drive files do not get updated correctly to indicate a change.
 
  • #3
Do you know how to remove or where to look to remove compiled files from the directory to force MATLAB to recompile a new version?

Thanks for taking interest to this!
 
  • #4
My memory is vague on this. Look in the same directory with your .m file that defines the function. It will have the same function name but will have a different extension.
 
  • Like
Likes member 428835
  • #5
Thanks a ton!
 

1. What is a PDE in MATLAB?

A PDE (Partial Differential Equation) in MATLAB is a mathematical equation that involves multiple variables and their partial derivatives. It is commonly used to model and solve problems in physics, engineering, and other fields.

2. How do I troubleshoot PDEs in MATLAB?

To troubleshoot PDEs in MATLAB, you can use the built-in PDE Toolbox or write your own code using the PDE functions and solvers. It is important to carefully check for errors in your input parameters, boundary conditions, and mesh settings.

3. What are some common errors when solving PDEs in MATLAB?

Some common errors when solving PDEs in MATLAB include incorrect input parameters, invalid boundary conditions, and insufficient or poor quality mesh. Other potential errors can arise from issues with the solver algorithm or numerical instability.

4. How can I improve the accuracy of my PDE solution in MATLAB?

To improve the accuracy of your PDE solution in MATLAB, you can refine the mesh, adjust the solver parameters, and increase the number of iterations for the solver. You can also try using a different solver or using adaptive mesh refinement techniques.

5. Can I visualize the PDE solution in MATLAB?

Yes, you can visualize the PDE solution in MATLAB using the built-in plotting functions or by exporting the solution data to other software such as Paraview. You can also plot the solution over time to see how it changes over the course of the simulation.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
14
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
928
  • Engineering and Comp Sci Homework Help
Replies
3
Views
801
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
2
Replies
41
Views
8K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
Back
Top