How to generate the rectangular signal from the image below using square function :

댓글 수: 2

How did you create the image in the first place? Since you created it, you must have the data. Why do you need to go from saved screenshot image to data when you should already have the data?
This image is given by the teacher. I have to write the code with necessary data to generate a graph as in the image.

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

답변 (2개)

Cris LaPierre
Cris LaPierre 2021년 3월 20일
편집: Cris LaPierre 2021년 3월 20일
Your teacher has gone so far as to even tell you what function to use. If you'd even looked at the documentation for square, you'd have the answer to your question already.
Image Analyst
Image Analyst 2021년 3월 20일
편집: Image Analyst 2021년 3월 20일
So you DON'T need to generate the array from doing image processing on the image itself. You just have to create an array that, when plotted, would look like the image. So I imagine he told you about the zeros() function for creating an array 70 long, and the equals operator to assign indexes from 20 to 40 to 1. So in 4 very simple lines of code, you should be able to do it.
y = zer............
y(.......... = ........
plot(y................
grid on

카테고리

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

제품

릴리스

R2019b

질문:

2021년 3월 20일

편집:

2021년 3월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by