필터 지우기
필터 지우기

i want to draw a half staircase sinusoidal curve

조회 수: 2 (최근 30일)
Muhammad Asad
Muhammad Asad 2022년 9월 27일
댓글: Muhammad Asad 2022년 10월 10일
I want to draw a half sinusoidal curve. In other means a pattern insert in a picture. I used for or if loop but not get success.
x-axis increases 20 sec and against it y-axis 1 sec.
I am highly appreciated for your answers.

채택된 답변

Walter Roberson
Walter Roberson 2022년 9월 27일
Use the Computer Vision insertShape function requesting a 'line' .
The coordinates for the line would need to duplicate every middle x value -- once for the bottom of the stair and once for the top of the stair.
  댓글 수: 8
Walter Roberson
Walter Roberson 2022년 10월 5일
The original question was about drawing that particular shape into an image.
You now talk about using the signal as an input to your turbine. You would never use an image of a signal as the input to your turbine; you would want the value of the points. And you would want the value to be computable based on the current clock, rather than having to pre-compute the value.
The below function generate_hump() accepts a time value and returns the appropriate signal level.
The function would need to be modified slightly if you wanted a periodic signal; in such a case we would need to know the exact point at which you wanted the signal to start to rise again. At the moment, your output for 350 is an extra 0; if your waveform were completely symmetric it would end at 340 rather than at 350.
t = 0:5:350;
num_t = length(t);
y = zeros(1, num_t);
for K = 1 : num_t
y(K) = generate_hump(t(K));
end
stairs(t, y); ylim([6 16])
function y = generate_hump(t)
if t >= 350
y = 0;
elseif t > 170
y = floor((350-t)/20);
else
y = floor(t/20);
end
y = y + 7;
end
Muhammad Asad
Muhammad Asad 2022년 10월 10일
Thanks. your answers are valueable.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by