Not getting desired plot in MATLAB

1 view (last 30 days)
AD
AD on 11 Mar 2023
Answered: Gayatri Rathod on 28 Apr 2023
I am trying to solve this ode using ode45 method...however, I am getting only a plot with y=0 at all values of x. Can someone help me to optimize or point out any mistake in my code? I have provided all the parameters and am only posting the equation.
F= @(e,f) 17.71*(((8*10^8)-((8.5*10^14)/(sqrt(e*D)))-(3.4749+0.988*D_v^(1/3))*sqrt(e*beta/D)-(5.58*(10^(15))*exp(-15.0234+150*b*sqrt(beta*e/D))*sqrt(beta*e/D))))/(((D_v*14.436*beta*e/D)/T)+26.4);
options=odeset('NonNegative',1);
[e,f]=ode45(F,[0 10],0,options);
plot(e,f);
axis([0 2*10^(-8) 0 3*10^6]);
  3 Comments
AD
AD on 11 Mar 2023
These are the parameters
b=2.49*(10^(-10));
M=1.67;
T= 400;
D= 23*(10^(-6));
D_Cu= 2.88*(10^(-4))*exp(-32571.56/T);
D_Ni= 0.68*(10^(-4))*exp(-31392.83/T);
beta=4.7*(10^10);
%Darken's Equation
D_v= 0.647*D_Cu + 0.3196*D_Ni;
Alan Stevens
Alan Stevens on 11 Mar 2023
You have a lot of very small values - these are giving values of f as zero. Try scaling your data/equation.

Sign in to comment.

Answers (1)

Gayatri Rathod
Gayatri Rathod on 28 Apr 2023
Hi AD,
Here are a few suggestions to try and debug the issue:
  • Check the parameter values: Review the values of the parameters used in the F function and make sure they are appropriate for the system you are modelling. Double-check the units and ensure that they are consistent with each other. For some parameters which you have provided, its value tends to zero or very small value. This can be the reason.
  • Verify the correctness of the ODE: Double-check the ODE itself to ensure that it is correctly implemented in the F function. You can do this by testing the ODE using other solvers or analytical methods and comparing the results with the ones obtained using ode45.
  • Check the time range: Ensure that the time range specified in the ode45 function is appropriate for the ODE. If the ODE has a very long transient, you might need to increase the simulation time range.
  • Try different initial conditions: It might be worth trying different initial conditions to ensure that the issue is not related to the initial conditions you have chosen.
You can read more about the ode45 and odeset functions from the following documentations: ode45 function, odeset function.
Hope it helps!

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!