How do you code this into MatLab Plot the following function
How do you code this into MatLab
Plot the following function: y(t) = {-3t^2 + 5, t greaterthanorequalto 0 3t^2 + 5, tSolution
Below is the function to plot the same in Matlab.
fplot(@(t) 3*t^2+5,[-9 -1],\'b\'); % f(t) = 3t^2 + 5 t < 0 [-9 -1]
hold on;
fplot(@(t) -3*t^2 +5, [0 9], \'g\'); % f(t) = -3t^2 + 5 t >=0 [0 9]
fplot(@(t) 3*t^2+5,[-9 -1],\'b\'); % f(t) = 3t^2 + 5 t < 0 [-9 -1] It will plot using -9 Value for t
Then Hold On will keep the previous plot and we will create a new plot as well.
fplot(@(t) -3*t^2 +5, [0 9], \'g\'); % f(t) = -3t^2 + 5 t >=0 [0 9] it will plot using 9 value for t

