Hello everyone, I have this question. Any help in appreciated. ^_^

조회 수: 1 (최근 30일)
Refat Chowdhury
Refat Chowdhury 2017년 3월 11일
댓글: Image Analyst 2017년 3월 11일
Building a square wave. It is defined as f(t) = {1 if 0 < t < T, -1 if –T < t < 0}.
a. Create a script that plots a single square wave. Label the graph.
b. Change the above script to include a train of square waves consisting of 4 squares pieces.

채택된 답변

Image Analyst
Image Analyst 2017년 3월 11일
Try repmat() or repelem(), or use the square() function.
  댓글 수: 2
Refat Chowdhury
Refat Chowdhury 2017년 3월 11일
Hi. So are you saying for part b, I am going to use one of these functions?
Image Analyst
Image Analyst 2017년 3월 11일
For part a, I'd use linspace to create T. Then I'd use ones() to create an array of 1's. Then I'd use indexing to set some of them to -1. Then I'd use plot(), title(), xlabel(), and ylabel() to make the plot.
For part b, I'd use repmat() to replicate the single pulse from part a.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by