Sum of series with a variable

4 ビュー (過去 30 日間)
Duc Anh Le
Duc Anh Le 2020 年 3 月 29 日
回答済み: David Hill 2020 年 3 月 29 日
I have the function , where are i-th components of given vectors respectively. I need to implement it Matlab and find the roots. I tried to use sum in a for loop and then fzero:
alpha = 0.5;
sum = 0;
for i = 1:n
sum = @(x) sum + y(i)^2/(z(i) - x)
end
fun = @(x) 1+alpha*sum
lambda = fzero(fun,0)
but it's not working. Any ideas how to fix this?

採用された回答

David Hill
David Hill 2020 年 3 月 29 日
I always like to look at what I am doing before solving. Numerially, it should be relatively easy to find the root.
alpha = 0.5;
f=@(x)1+alpha*arrayfun(@(a)sum(y./(z-a)),x);
x=-100:100;
plot(x,f(x));

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by