Bandwidth analysis for photodiode TIA using matlab
Rise time \$t_r\$ is defined as the time required for the signal to go from 10% to 90% of its final value. The fall time \$t_f\$ is defined in a similar fashion: as the time required for the signal to go from 90% to 10% of its initial value.

So in your MATLAB code you should look up at which time instants do these conditions happen and then compute the differences to find \$t_r\$ and \$t_f\$.

Then, assuming a behaviour similar to that of an RC network, the bandwidth can be shown to be as follows:

$$
BW = \frac{0.35}{t_r}
$$

If \$t_r\$ and \$t_f\$ happen to be very different, then use \$\max(t_r,t_f)\$ instead of \$t_r\$ for the calculation of the bandwith, because the slowest transition will always be the bandwidth-limiting one.

Note below:

For a full discussion about how the \$BW\$ formula is derived, take a look at this article.