How do I plot a prod function in MATLAB?

5 次查看(过去 30 天)
My equation I am trying to do is 2*∏((t-5)/4), my graph is suppose to look like this:
I tried using the heaviside() but that didn't seem to work? This is the current code I have but nothing comes up?
This is the goal:
update: This is how far I got but can't seem to figure how to go down?
%This is the h(t)
t = 1:1:10;
ht = 2 * heaviside((t-5)/4);
plot(t, ht, 'b')
axis([0 10 0 4])

采纳的回答

Matt J
Matt J 2023-3-20
编辑:Matt J 2023-3-20
fun=@(t) abs(t-5)<=1/2;
fplot(fun,[1,10]); axis padded

更多回答(1 个)

Walter Roberson
Walter Roberson 2023-3-20
syms t N
ht = 2 * symprod((t-5)/4, t, 1, N)
ht = 
T = 1:10;
y = double(subs(ht, N, T))
y = 1×10
-2.0000 1.5000 -0.7500 0.1875 0 0 0 0 0 0
plot(T, y)

类别

Help CenterFile Exchange 中查找有关 Mathematical Functions 的更多信息

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by