How to perform cumulative product on a discrete signal in Matlab

1 回表示 (過去 30 日間)
Varun Baskar
Varun Baskar 2020 年 6 月 2 日
回答済み: Sai Sri Pathuri 2020 年 7 月 9 日
I tried to perform cumulative product on a discrete signal. But it keeps throwing errors. Am not sure how to go about it.
Here's my code:
function [i_o,q_o] = Accumulate(I, Q)
cumprod = dsp.CumulativeProduct;
i_o = cumprod(I);
q_o = cumprod(Q);
Thanks
  3 件のコメント
Steven Lord
Steven Lord 2020 年 6 月 2 日
What is the full and exact text of the error messages you receive when you run your code? Show us all the text displayed in red in the Command Window when you run your Accumulate function.
Varun Baskar
Varun Baskar 2020 年 6 月 2 日
Hi Steven,
I get the followinge error:
Error using Accumulate (line 13)
Not enough input arguments.
Line 13 is this line: i_o = cumprod(I);

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

回答 (1 件)

Sai Sri Pathuri
Sai Sri Pathuri 2020 年 7 月 9 日
How did you call the function? I assume you didn't pass input arguments
It must be called with input arguments, like
%
% Code to find (or) define I, Q
%
[i_o,q_o] = Accumulate(I, Q); % Call the function with input arguments
%
% Code using i_o, q_o
%
function [i_o,q_o] = Accumulate(I, Q)
cumprod = dsp.CumulativeProduct;
i_o = cumprod(I);
q_o = cumprod(Q);
end

カテゴリ

Help Center および File ExchangeArray and Matrix Mathematics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by