How to plot the function x(t) = 10e^(3t)*u(t) thanks a lot

I have this question and I am not good with coding using matlab. Can someone please help me

1 Comment

The problem here is that you are no specifying the time interval in which you want to plot the function, and you are not specifying what u(t) is.
Imagine you want to plot the function x(t) = 10e^(3t) in the time interval t=[0,2], sampling with time interval t=0.1, then the code is:
>> t=0:0.1:2;
>> y=10*exp(3*t);
>> plot(t,y)

Sign in to comment.

Answers (2)

t=0:0.1:2;
>> y=10*exp(3*t);
>> plot(t,y)

1 Comment

u(t) is a unit step signal, which has a value of 0 for negative time and has a value of 1 for positive time, and can be plotted by calling heaviside(t),
t=0:0.1:2;
>> y=10*exp(3*t).*heaviside(t);
>> plot(t,y)

Sign in to comment.

t=-5:0.1:5;
if(t>=0)
u=1;
end
if(t<0)
u=0;
end
x=10*exp(3*t).*u;
Unrecognized function or variable 'u'.
plot(t,x);
xlabel('t'); ylabel('x(t)');
title('signal x(t)');

1 Comment

Hi @Revanth, The code you provided has an error. In MATLAB, a vector cannot be used as the condition in an if statement. Consider revising your code and keep the if statement. 😃
t = -5:0.1:5;
u = zeros(size(t)); % Pre-allocation
u(t>=0) = 1;
x = 10*exp(3*t).*u;
plot(t, x);, grid on
xlabel('t');
ylabel('x(t)');
title('signal x(t)');

Sign in to comment.

Categories

Find more on MATLAB in Help Center and File Exchange

Tags

Asked:

on 13 Mar 2013

Commented:

on 19 Jan 2024

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!