フィルターのクリア

Plotting sequences over intervals

16 ビュー (過去 30 日間)
Connor Wright
Connor Wright 2020 年 11 月 13 日
回答済み: Md. Monirul Islam 2022 年 10 月 30 日
Hello,
How would I go about plotting a seqeunce over the below intervals?
A) 𝑥(𝑛) = 2𝛿(𝑛 + 1)− 𝛿(𝑛 −6), −10 ≤ 𝑛 ≤ 10.
B) 𝑥(𝑛) = {… , 5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1, … }; −20 ≤ 𝑛 ≤ 12.
Thanks
  6 件のコメント
Connor Wright
Connor Wright 2020 年 11 月 16 日
Thanks for the help, just been looking through and doing some playing around with the code you have provided, I have run into an issue with usmpl repeatedly. MatLab throws the error, Unrecognized function or variable 'usmp1'.
Is this part of an add in package?
Jon
Jon 2020 年 11 月 19 日
I define it as a helper function in my script above

サインインしてコメントする。

採用された回答

Jon
Jon 2020 年 11 月 19 日
You could do it like this
n = -10:10
x = zeros(length(n),1) % preallocate array of zeros to hold result
for k = 1:length(n)
% evaluate x(n)
x(k) = 2*usmpl(n(k)+ 1) - usmpl(n(k)-6);
end
% plot result
stem(n,x)
% define helper function
function delta = usmpl(n)
% define unit sample function
if n == 1
delta = 1
else
delta = 0
end
end
  6 件のコメント
Connor Wright
Connor Wright 2020 年 11 月 19 日
I'm studying Electronic and Electrical Engineering, I am a fabricator, machinist, welder by trade and blacksmith by hobby who doesn't have any formal Mathematics qualification. So with that said you can belive I have many questions 😂
Jon
Jon 2020 年 11 月 20 日
Great that your working on developing your skills, sounds like you have lots of talents, definitely post some new questions if you have more MATLAB questions. I've learned a lot from this site, there are a lot of knowledgeable people answering questions. By the way, you may already be beyond this, but if not the MATLAB On Ramp course is good for getting a quick start https://www.mathworks.com/learn/tutorials/matlab-onramp.html

サインインしてコメントする。

その他の回答 (5 件)

SaiDileep Kola
SaiDileep Kola 2020 年 11 月 16 日
Hi Connor,
Start by copying complete code provided by Jon and usmpl is just a local function created to use. Don't use usmpl in the terminal without defining, that will solve your issue.
  7 件のコメント
Connor Wright
Connor Wright 2020 年 11 月 19 日
I understand completely Jon, if your answer was posted on the answers I would of accepted yours. I do truly appreciate your help however, after a little digging around I managed to sort the graph output out turns out that all that needed to be done was to change the delta value to 2*1.
Jon
Jon 2020 年 11 月 19 日
Oops now I feel kind of silly, didn't realize I had just continued my original comment. I will try to copy and paste into an answer.

サインインしてコメントする。


Noor Hossen
Noor Hossen 2021 年 7 月 18 日
編集済み: Noor Hossen 2021 年 7 月 18 日
(A).
Step 1. At first, needed to make a script file of delta function. It would be
Step 2. Then write another on script file following the problem statement
Output-----------

Sumon Gharame
Sumon Gharame 2021 年 9 月 30 日
help

Md. Monirul Islam
Md. Monirul Islam 2022 年 10 月 30 日
δ(n+2)

Md. Monirul Islam
Md. Monirul Islam 2022 年 10 月 30 日
δ(n+2)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by