Azzera filtri
Azzera filtri

adding float number of different size array

2 visualizzazioni (ultimi 30 giorni)
Saiem Solimullah
Saiem Solimullah il 28 Giu 2018
Modificato: Mandeep Singh il 28 Giu 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....

Risposte (1)

Mandeep  Singh
Mandeep Singh il 28 Giu 2018
Modificato: Mandeep Singh il 28 Giu 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

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by