Borrar filtros
Borrar filtros

Sumatorio en matlab para una señal

3 visualizaciones (últimos 30 días)
Francisco Gabriel
Francisco Gabriel el 23 de Oct. de 2023
Respondida: Varun el 31 de Oct. de 2023
Como se puede escribir esta función ya que lo he intentado de mil maneras y me pone error ya que no se como expresar la señal escalon unidad aparte para crear la función y tampoco poner el sumatorio de x4 (t)=∑ n=−∞ ∞ (−1)n ( u(t−nT)−u ( t−nT−T 2 ))

Respuestas (1)

Varun
Varun el 31 de Oct. de 2023
Hi Francisco,
Como no soy hablante nativo de coreano, intentaré responder esta pregunta en inglés. Gracias por su comprensión.
Looks like you are facing difficulties in writing the summation for x4 (t)=∑ n=−∞ ∞ (−1)n ( u(t−nT)−u ( t−nT−T 2 )) and you need assistance in implementing unit step function to be used for this summation.
Please refer the following code snippet to write the function which you described:
function x4 = functionX4(t, T, n_min, n_max)
x4 = 0; % Initialize the value of x4
for n = n_min:n_max
u1 = heaviside(t - n*T);
u2 = heaviside(t - n*T - T/2);
x4 = x4 + (-1)^n * (u1 - u2);
end
end
You can call the function "functionX4" as follows:
result = functionX4(1,2,-100000,100000)
In this example, a function called "functionX4" is defined, which takes 4 arguments "t", "T", "n_min", "n_max". "t" represents time, "T" is the period of the signal and "n_min" and "n_max" represents lower and higher bounds for the summation respectively.
Inside the function, "x4" is initialized with a value of zero. Then, a for loop is used to perform the summation from "n_min" to "n_max". In each iteration of the loop, the values of "u1" and "u2" are calculated using the "heaviside" function, also known as the unit step function. Finally, the value of "x4" is updated by adding the corresponding term of the summation.
To learn more about using "heaviside" function, please refer to the following documentation:
Hope it helps.

Etiquetas

Community Treasure Hunt

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

Start Hunting!