# Iterative loop function for FEA

조회 수: 2 (최근 30일)
Christopher Morrow 2021년 4월 1일
답변: Abhishek Gupta 2021년 4월 21일
K=[1 2 -2,
2 1 -5,
1 -4 1]
F=[-15 -21 18]
Xo=[1 1 1]'
r=F-K*Xo
alpha=(r'*r)/(r'*K*r)
Xn=X+alpha*r
I am trying to make an iterative loop function from n=4 iteration where r, alpha, and Xn change with respect to the new Xn. I am using the conjugate gradient method for FEA. Any suggestions on possibly using a for loop?

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

### 답변 (1개)

Abhishek Gupta 2021년 4월 21일
Hi,
As per my understanding, you would like to implement an iterative loop to update 'r,' 'alpha,' and 'Xn.' To achieve this task, you can use either a for or a while loop. For more information related to implementation, check out the documentation links below: -

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

### 카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

### Community Treasure Hunt

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

Start Hunting!

Translated by