Add x1[n] = exp(−n/4), −4 ≤ n ≤ 8 with x2[n] = cos(πn/4), 0 ≤ n ≤ 12. Plot x1[n], x2[n], and y[n].

4 visualizaciones (últimos 30 días)
Albert
Albert el 8 de Oct. de 2022
Editada: vidyesh el 15 de Sept. de 2024
Hello, I am having a problem with this. I couldn't identify where to start. Thank you.

Respuestas (1)

vidyesh
vidyesh el 15 de Sept. de 2024
Editada: vidyesh el 15 de Sept. de 2024
Hi Albert,
The starting point would be to decide the period of signals/sample spacings. I am assuming 0.01.
1) define 'n' between -4 and 12 with increments of 0.01.
n = -4:0.01:12;
2) You can then use indexing to set the range of your signals while defining them. For example
% Define your signal, I have assumed x1 is 0 outside of mentioned range
x1 = zeros(1,numel(n));
% Define the function for all values of n
sig1 = exp(-1*n/4);
% Define the range for which function is defined
range = n>=-4 & n<=8;
% Store the values of the signal within the defined range only
x1(range) = sig1(range);
3) Similarly you can plot 'x2' and calculate 'y' and then plot them:
The below documentation pages contain more information regarding the functions that need to be utilized.

Categorías

Más información sobre Labels and Styling en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by