Can't run my main Matlab file related to ODE solution

  • Context: MATLAB 
  • Thread starter Thread starter Ein Krieger
  • Start date Start date
  • Tags Tags
    File Matlab Ode
Click For Summary

Discussion Overview

The discussion revolves around troubleshooting errors encountered while attempting to solve a diffusivity equation using MATLAB's ODE solver. Participants are seeking assistance in identifying mistakes in the numerical solution and interpreting error messages related to undefined variables and functions.

Discussion Character

  • Technical explanation
  • Homework-related
  • Debate/contested

Main Points Raised

  • One participant reports an error indicating an "Undefined function or variable 'r'" when executing the ODE solver, specifically in the function_handle2.
  • Another participant notes a similar error on line 10 of function_handle2 and mentions that commenting it out leads to a new error due to 'dss004' being undefined.
  • A third participant provides a link to download the 'dss004' m file, indicating it is necessary for the function to work correctly.
  • A later post expresses frustration over finding a solution to the PDE and mentions that multiple approaches have been tried, with attached files representing the latest attempt.

Areas of Agreement / Disagreement

Participants generally agree on the existence of errors in the MATLAB code but do not reach a consensus on the specific solutions or the underlying issues causing these errors. Multiple competing views on how to resolve the problems remain.

Contextual Notes

Limitations include potential missing definitions for variables such as 'r' and 'dss004', as well as unresolved dependencies on the attached M files. The discussion does not clarify the mathematical steps necessary to resolve the PDE.

Who May Find This Useful

Readers interested in numerical methods for solving partial differential equations, MATLAB programming, or those facing similar issues with ODE solvers may find this discussion relevant.

Ein Krieger
Messages
32
Reaction score
0
Hey, guys

Can you please help me to spot mistakes in numerical solution of following diffusivty equation:

∂P/∂t= 0.001127*k/(μ*ϕ*c_t )*((∂P/∂x)^2*c+(∂^2 P)/(∂x^2 )).

Matlab give the following command:

Undefined function or variable 'r'.

Error in function_handle2 (line 9)
for i=1:r

Error in odearguments (line 88)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.

Error in ode15s (line 149)
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...

Error in Diffusivity_equation (line 41)
[t,p]=ode15s(@function_handle2,tout,p0,options);


I don't know how to interpret the last command. M files containing relevant commands are attached.
 

Attachments

Physics news on Phys.org
I get an error on line 10 of function_handle2. When I comment it out, I get an error because dss004 is undefined.
 
DrClaude said:
I get an error on line 10 of function_handle2. When I comment it out, I get an error because dss004 is undefined.

Hey, mate

You can download dss004 m file from the following link:
https://www.physicsforums.com/showthread.php?p=4292439#post4292439.

I couldn't upload the dss004 file, so decided to redirect you to my previous post where I have already atttached dss004.
 
Guys, I need to solve by Matlab the following PDE:
4e5c3bb7979f.png


I am desperate about finding solution; I have tried many approaches, and the files attached on topic start is my last approach.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 5 ·
Replies
5
Views
6K