Not getting desired plot in MATLAB
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Alan Stevens
il 11 Mar 2023
You have a lot of very small values - these are giving values of f as zero. Try scaling your data/equation.
Risposte (1)
Gayatri Rathod
il 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!
0 Commenti
Vedere anche
Categorie
Scopri di più su Ordinary Differential Equations in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!