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, t

Solution

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

How do you code this into MatLab Plot the following function: y(t) = {-3t^2 + 5, t greaterthanorequalto 0 3t^2 + 5, t SolutionBelow is the function to plot the

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site