Info

この質問は閉じられています。 編集または回答するには再度開いてください。

how can i make an iterative solve in my finction

1 回表示 (過去 30 日間)
wassim boulala
wassim boulala 2020 年 4 月 30 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
hi everyone ,
am trynig to make a function of two inputs .in this function it might be have an iterative equation ;
the inputs are :
Tm and d , Tm is a normal value and d is a vector
first i caculate L_0 which is
L_0=9.81*T^2/2*pi
and comes the iterative equation
L=L_0*tanh(2*pi*d./L)
how can i make this eteative equation in my function? help me please
thank you

回答 (1 件)

Ameer Hamza
Ameer Hamza 2020 年 5 月 1 日
Try this
L = fun(1, 2, 100) % run for 100 iterations
function L_plus_1 = fun(T,d,N) % N is number of iterations
L_0 = 9.81*T^2/2*pi;
L_1 = L_0*ones(size(d));
L_plus_1 = zeros(size(d));
for i=1:N
L_plus_1 = L_0*tanh(2*pi*d./L_1);
L_1 = L_plus_1;
end
end
  2 件のコメント
wassim boulala
wassim boulala 2020 年 5 月 1 日
yes that works thank you!
Ameer Hamza
Ameer Hamza 2020 年 5 月 1 日
I am glad to be of help.

Community Treasure Hunt

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

Start Hunting!

Translated by