Generating A Step Like Function In MATLAB.
2 次查看(过去 30 天)
显示 更早的评论
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!
0 个评论
采纳的回答
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 个评论
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 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!