using 3x1 matrix to make 21x1 matrix
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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
the overlapped elements should be added. I want to use a for loop to create the matrix unless there's another method
2 comentarios
Walter Roberson
el 11 de Nov. de 2019
Is it correct that after the first entry, it just keeps repeating [f12; f13+f11] over and over?
Shubham Gupta
el 11 de Nov. de 2019
Do you want something like this?
f_out = [f(1);repmat([f(2);f(2)+f(3)],[10,1])]
Respuestas (1)
Prabhan Purwar
el 20 de En. de 2020
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?
0 comentarios
Ver también
Categorías
Más información sobre Elementary Math en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!