Borrar filtros
Borrar filtros

Generating A Step Like Function In MATLAB.

1 visualización (últimos 30 días)
Pranjal Pathak
Pranjal Pathak el 6 de En. de 2012
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!

Respuesta aceptada

Titus Edelhofer
Titus Edelhofer el 6 de En. de 2012
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 comentarios
Pranjal Pathak
Pranjal Pathak el 6 de En. de 2012
Sir, Thanks for your answers. Now can you help me in finding the slopes of this step function IN matlab?
Titus Edelhofer
Titus Edelhofer el 6 de En. de 2012
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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by