# How do I plot a prod function in MATLAB?

3 visualizzazioni (ultimi 30 giorni)
Monqiue Parrish il 20 Mar 2023
Commentato: Monqiue Parrish il 20 Mar 2023
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])
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposta accettata

Matt J il 20 Mar 2023
Modificato: Matt J il 20 Mar 2023
fun=@(t) abs(t-5)<=1/2;
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Monqiue Parrish il 20 Mar 2023
Ok that seem to work

Accedi per commentare.

### Più risposte (1)

Walter Roberson il 20 Mar 2023
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)
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Monqiue Parrish il 20 Mar 2023
Sorry I updated the question with the desire graph. But I've tried the symprod

Accedi per commentare.

### Categorie

Scopri di più su Mathematical Functions in Help Center e File Exchange

R2023a

### Community Treasure Hunt

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

Start Hunting!

Translated by