I'm running a function that solves a given PDE using Euler's method
I attempt to plot the numerical solutions to the PDE at specific times (0.1, 0.5, 1.0 and 2.0) by testing equalities for t in an IF statement
However, only plots for t == 0.1 and t == 0.5 are plotted for some reason
I've tried debugging with breakpoints and the IF statement tests true when t == 0.1 and 0.5, but false when t == 1 and 2, even though the variable t in the workspace == 1 and 2
The relevant code is:
t = 0;dt = 0.1;for a = 1 : timesteps for b = 1 : nodes u = %solve PDE;
end t = t + dt; round(t,1); if t == 0.1 || t ==0.5 || t == 1.0 || t == 2.0 figure plot(t,u) end end
Best Answer