필터 지우기
필터 지우기

Generating A Step Like Function In MATLAB.

조회 수: 1 (최근 30일)
Pranjal Pathak
Pranjal Pathak 2012년 1월 6일
Hi, Previous suggestion to my question was alright. That was much useful to generate a step like function using the command"stairs". But I need to do it without using the standard in-built functions. So, can anyone please help me in generating a stair like function using for loops(or something like that) whose increment and decrement should be by same amount and rises upto a certain height,in MATLAB.
Thanking You!

채택된 답변

Titus Edelhofer
Titus Edelhofer 2012년 1월 6일
Hi,
in this case I would take a look at the output of stairs, e.g.
[x,y]=stairs(1:3, 2:0.5:3)
x =
1
2
2
3
3
y =
2.0000
2.0000
2.5000
2.5000
3.0000
and try to achieve the same using "pure" MATLAB code ...
Titus
  댓글 수: 2
Pranjal Pathak
Pranjal Pathak 2012년 1월 6일
Sir, Thanks for your answers. Now can you help me in finding the slopes of this step function IN matlab?
Titus Edelhofer
Titus Edelhofer 2012년 1월 6일
The slope is the ratio by how fast the y values grow devided by how fast the x values grow. If you plot the stairs above (e.g. call stairs without "[x,y]=", followed by "axis equal" you will see, that those stairs have a slope of 0.5 ...
Titus

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by