MATLAB Answers

0

How I can Plots this function

Asked by Mohamed Hussein on 16 Feb 2019
Latest activity Answered by Star Strider
on 16 Feb 2019
how can write the code of this function

  0 Comments

Sign in to comment.

2 Answers

Answer by Yasasvi Harish kumar on 16 Feb 2019

Hey,
This should help you.
function x = question(t)
if t >=0
x = 3*exp(-2*t);
else
x = 0;
end
end
Regards

  0 Comments

Sign in to comment.


Answer by Star Strider
on 16 Feb 2019

Another approach:
x = @(t) 3*exp(-2*t) .* (t >= 0);
t = linspace(-10,10);
figure
plot(t, x(t))

  0 Comments

Sign in to comment.