Effacer les filtres
Effacer les filtres

adding float number of different size array

2 vues (au cours des 30 derniers jours)
Saiem Solimullah
Saiem Solimullah le 28 Juin 2018
Modifié(e) : Mandeep Singh le 28 Juin 2018
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....

Réponses (1)

Mandeep  Singh
Mandeep Singh le 28 Juin 2018
Modifié(e) : Mandeep Singh le 28 Juin 2018
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

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by