필터 지우기
필터 지우기

adding float number of different size array

조회 수: 2 (최근 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 CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by