How to plot the function x(t) = 10e^(3t)*u(t) thanks a lot
103 views (last 30 days)
Show older comments
I have this question and I am not good with coding using matlab. Can someone please help me
1 Comment
Carlos
on 13 Mar 2013
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)
Answers (2)
zohaib ahmed malik
on 23 Nov 2020
t=0:0.1:2;
>> y=10*exp(3*t);
>> plot(t,y)
1 Comment
Muganza Yumba
on 7 May 2022
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)
Revanth
on 19 Jan 2024
Edited: Sam Chak
on 19 Jan 2024
t=-5:0.1:5;
if(t>=0)
u=1;
end
if(t<0)
u=0;
end
x=10*exp(3*t).*u;
plot(t,x);
xlabel('t'); ylabel('x(t)');
title('signal x(t)');
1 Comment
Sam Chak
on 19 Jan 2024
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)');
See Also
Categories
Find more on Bartlett in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!