how can I do Iteration in matlab
이전 댓글 표시
I have an equation of the form
a(x) + x.da/dx = 2x , x= 1:1:12
f(x) is known and has different values for different x. My question is how can I find values of 'a' in matlab through iteration. Am new to matlab and any help is highly appreciated.
채택된 답변
추가 답변 (1개)
Azzi Abdelmalek
2012년 11월 17일
편집: Azzi Abdelmalek
2012년 11월 17일
save this funnction with the name dif_eq
function da=dif_eq(x,a)
f=sin(x); for example
da=(f-a)/x;
then type in Matlab command
[x,res]=ode45(@dif_eq,[1 12],0)
댓글 수: 5
Ede gerlderlands
2012년 11월 17일
Azzi Abdelmalek
2012년 11월 17일
편집: Azzi Abdelmalek
2012년 11월 17일
You said that f is a function of x, then replace in my code, f=sin(x) by your own function
The code I did solves your differential equation
Ede gerlderlands
2012년 11월 17일
Ede gerlderlands
2012년 11월 17일
Azzi Abdelmalek
2012년 11월 17일
Ede, the problem is not a, we are looking for a. I can't use f with different values in the equation. If I find something I will post it, or someone else will do.
카테고리
도움말 센터 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!