フィルターのクリア

wanted help in matlab code

2 ビュー (過去 30 日間)
adarsh
adarsh 2018 年 2 月 17 日
コメント済み: Star Strider 2018 年 2 月 17 日
I have:
d1=k(1); d2=k(2);d3=k(3)...............d190=k(190);
then
p1=k(191);p2=k(192);p3=k(193)..................p220=k(310)
To avoid writing all the terms individually, i want to define these statement in short, something like
d(1:190)=k(1:190);
and then
p(1:22)=k(191:310)
Is this way of writing correct.
Thanks in advance

採用された回答

Star Strider
Star Strider 2018 年 2 月 17 日
‘Is this way of writing correct.’
Yes. You can simplify it even more as:
d = k;
The second assignment needs to be changed to:
p = k(191:310);
since those values of ‘k’ are a vector of 120 elements, so you would have to subscript ‘p’ with at least as many values to avoid an error.
  2 件のコメント
adarsh
adarsh 2018 年 2 月 17 日
編集済み: Walter Roberson 2018 年 2 月 17 日
so if i have;
d1=k(1); d2=k(2);d3=k(3)...............d190=k(190); then p1=k(191);p2=k(192);p3=k(193)..................p220=k(310); and v1=k(311).........v20=k(330);
then can i go as:
d=k(1:190)
p=k(191:310);
v=k(311:330)
is this way correct
Star Strider
Star Strider 2018 年 2 月 17 日
It appears to me to be correct.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by