필터 지우기
필터 지우기

using 3x1 matrix to make 21x1 matrix

조회 수: 1 (최근 30일)
Maria Galle
Maria Galle 2019년 11월 11일
답변: Prabhan Purwar 2020년 1월 20일
I have built the 3x1 matrix below
EA = 1;
h = 1;
P = 1
FF = @(xi) (0.5*xi).*(xi-1)
f(1,1) = P*h/2*quad(FF,-1,1)
FF = @(xi) (1-xi.^2)
f(2,1)= P*h/2*quad(FF,-1,1)
FF = @(xi) (0.5*xi).*(xi+1)
f(3,1) = P*h/2*quad(FF,-1,1)
I want to use the 3x1 matrix to create a 21x1 matrix following the pattern below
new doc 2019-11-10 22.57.58_1.jpg
the overlapped elements should be added. I want to use a for loop to create the matrix unless there's another method
  댓글 수: 2
Walter Roberson
Walter Roberson 2019년 11월 11일
Is it correct that after the first entry, it just keeps repeating [f12; f13+f11] over and over?
Shubham Gupta
Shubham Gupta 2019년 11월 11일
Do you want something like this?
f_out = [f(1);repmat([f(2);f(2)+f(3)],[10,1])]

댓글을 달려면 로그인하십시오.

답변 (1개)

Prabhan Purwar
Prabhan Purwar 2020년 1월 20일
Hey,
Following command may help:
f_out = [f(1);repmat([f(2);f(1)+f(3)],10,1)];
Could you elaborate more if this is not the desired output?

카테고리

Help CenterFile Exchange에서 Elementary Math에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by