フィルターのクリア

adding float number of different size array

4 ビュー (過去 30 日間)
Saiem Solimullah
Saiem Solimullah 2018 年 6 月 28 日
編集済み: Mandeep Singh 2018 年 6 月 28 日
How to add or multiply two different size of array using the loop iteration process? suppose ,an array
a=[.1 -.2 .13 .4 -.15 .26 .17 -.28 .19 .21] b=[.1 -.22 .06] and i want increase the size of the 'b' array using. for loop. as like the value of 'b' after using for loop is
= [.1 -.22 .06 .1 -.22 .06 .1 -.22 .06 .1] Then, we will add or multiply this array.That will very much appreciating if anyone can give a matlab code for this problem....

回答 (1 件)

Mandeep  Singh
Mandeep Singh 2018 年 6 月 28 日
編集済み: Mandeep Singh 2018 年 6 月 28 日
You can achieve the required values for the matrix b using the following set of commands
a=[.1 -.2 .13 .4 -.15 .26 .17 -.28 .19 .21]
b=[.1 -.22 .06]
bb = repmat(b,[1,round(size(a)/size(b)+1)]) %make repetition of the matrix b
bb = bb(1:size(a,2)) %make the size of matrix bb equal to a

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by