How to write squarewave in matlab

I need to include a squarewave command in my matlab script. I have a function, c(1)+c(2)*1/6*d(t), where d(t) is my squarewave with the values:
R, 0<= 0 t <= 1 0, 1 <= t < Tp
How do I write this in matlab? I know it is square(t,Tb,Tp)*R, but it doesn't work.

1 commentaire

Daniel Shub
Daniel Shub le 25 Fév 2013
What doesn't work? What commands are you typing? What error do you get? What do you expect to get?

Connectez-vous pour commenter.

Réponses (1)

Thorsten
Thorsten le 25 Fév 2013

0 votes

t = linspace(0, 10);
R = 0.3;
y = R*square(t*pi);
plot(t,y)

2 commentaires

Angelina
Angelina le 25 Fév 2013
But how do I include my value Tp?
Tp = 1.5;
y = R*square(t*2*pi/(1+Tp), 1/(1+Tp)*100);

Connectez-vous pour commenter.

Catégories

En savoir plus sur Software Development dans Centre d'aide et File Exchange

Question posée :

le 25 Fév 2013

Community Treasure Hunt

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

Start Hunting!

Translated by