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

Daniel Shub
Daniel Shub 2013년 2월 25일
What doesn't work? What commands are you typing? What error do you get? What do you expect to get?

댓글을 달려면 로그인하십시오.

답변 (1개)

Thorsten
Thorsten 2013년 2월 25일

0 개 추천

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

댓글 수: 2

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

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Software Development에 대해 자세히 알아보기

질문:

2013년 2월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by