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

  • Thread starter Thread starter Ein Krieger
  • Start date Start date
  • Tags Tags
    File Matlab Ode
AI Thread Summary
The discussion revolves around troubleshooting errors encountered while attempting to solve a diffusivity equation using MATLAB. The primary issue is an "Undefined function or variable 'r'" error occurring in the function_handle2 file, specifically on line 9 during a loop execution. This error suggests that the variable 'r' has not been defined prior to its use. Additionally, when the problematic line is commented out, another error arises due to 'dss004' being undefined, indicating that this variable or function is crucial for the execution of the code. The user has provided a link to download the dss004 m file for further assistance and expresses frustration over the inability to find a solution despite multiple attempts. The focus remains on resolving these coding errors to successfully implement the numerical solution of the partial differential equation (PDE).
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
Views
1K
Replies
2
Views
3K
Replies
5
Views
2K
Replies
2
Views
3K
Back
Top