To plot the solution y(t)
vs. t
for the given equation y(t) = ce^(-t)
in the range t ∈ [0, 5]
with a discretization step ∆t = 0.1
in MATLAB, you can follow these steps:
t
using the 0:0.1:5
syntax.y(t)
using the given equation.y(t)
against t
using the plot
function.grid on
command (optional).Here's the MATLAB code to plot the solution:
main.m148 chars10 lines
Running this code will generate a plot showing the solution y(t)
vs. t
in the specified range with the discretization step ∆t = 0.1
.
gistlibby LogSnag