フィルターのクリア

how can I do Iteration in matlab

4 ビュー (過去 30 日間)
Ede gerlderlands
Ede gerlderlands 2012 年 11 月 17 日
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.

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2012 年 11 月 17 日
編集済み: Azzi Abdelmalek 2012 年 11 月 17 日
save this function with the name dif_eq
function da=dif_eq(x,a,tim,f)
f1=interp1(tim,f,x)
da=(f1-a)/x;
then call the function:
t=[0.1:10]; % time vector
x0=0; % initial condition
f=rand(1,numel(t)); % your vector f, same length as vector time t
[X,A]=ode45(@(x,a) dif_eq(x,a,t,f),t,x0);
plot(X,A)
  1 件のコメント
Ede gerlderlands
Ede gerlderlands 2012 年 11 月 17 日
Many many thanks ...don't have words for your help....this was so troublesome...

サインインしてコメントする。

その他の回答 (1 件)

Azzi Abdelmalek
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
Ede gerlderlands 2012 年 11 月 17 日
Thanks Azziz , I understand your function but 'a' itself isn't known and that's my problem.
Azzi Abdelmalek
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.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by