I have plotted the solution for two odes against time.
The two odes are given in the following.
What I would like to do is also plot dB/dt vs. time (differential equations themselves).
The code I have now is not wokring properly. I was wondering if I make any mistake with the codes?
if t < 20
clc;close all; clear all;
[tsol,varsol]=ode45(@(t,var) odes(t,var), timerange, ICs);
pvar = gradient(varsol(:,3));
dt = gradient(tsol);
hq = quiver(tsol, varsol(:,3), dt, pvar, 6);
Figure 1 is the plot I got for B(t) vs. time.
Figure 2 is dB/dt vs. time (which is incorrect result)
If I extract the datapoints from Figure 1 and replot it in excel. I got Figure 3 which is the same as Figure 1.
After that, I was using these datapoints to plot dB/dt vs. time then got Figure 4 which is very different from Figure 2.
Therefore, I was wondering if there is anything wrong with my codes? It would be greatly appreciated if anyone can help. Thank you in advance!