How do you generate a stair up MATLAB function?

 Respuesta aceptada

Star Strider
Star Strider el 30 de En. de 2019
Try this:
t = 0:100;
s = floor(rem(t, 10.1));
figure
stairs(t, s)
Experiment to get the result you want.

6 comentarios

Ahmed Aldulaim
Ahmed Aldulaim el 30 de En. de 2019
Thank you!!!!!!!!
Star Strider
Star Strider el 30 de En. de 2019
My pleasure.
If my Answer helped you solve your problem, please Accept it!
Ahmed Aldulaim
Ahmed Aldulaim el 30 de En. de 2019
I need to create a stair-up function with the following paramaters
amplitude= 1.05
offset=-.08
frequency= 14 Hertz
I couldn't do it with the code you gave me ):
Try this for a start:
N = 0.5; % Number Of Cycles
A = 1.08; % Amplitude
Ofst = -0.08; % Offset
f = 60/14; % Frequency (Period)
t = linspace(0, 60*N, 60*N*3);
s = (rem(t, f))*A./f + Ofst;
figure
stairs(t, s)
Experiment to get the result you want.
Ahmed Aldulaim
Ahmed Aldulaim el 30 de En. de 2019
Thank you sir! It helped.
Star Strider
Star Strider el 30 de En. de 2019
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Preguntada:

el 30 de En. de 2019

Comentada:

el 30 de En. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by