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].
2 次查看(过去 30 天)
显示 更早的评论
Hello, I am having a problem with this. I couldn't identify where to start. Thank you.
0 个评论
回答(1 个)
vidyesh
2024-9-15
编辑:vidyesh
2024-9-15
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!