How to compute a summation of the following equation?

1 次查看(过去 30 天)
I need to compute it dynamically. Please help me out with the code. Please find the attachment.... Thank you

回答(1 个)

Walter Roberson
Walter Roberson 2015-8-26
pequiv = a * sum(rho .* h);
  2 个评论
shishir kumar
shishir kumar 2015-8-28
Hi Roberson, thanks for your answer but here we cannot calculate for the condition of 1 to N that's been mentioned in the equation. Also it should take the values for the set of values for rho and h as given in the equation. If you come across the answer pls help me out.
Walter Roberson
Walter Roberson 2015-8-28
Is there a reason why rho or h would not be length N?
If there is a reason why they are longer then use
pequiv = a * sum(rho(1:N) .* h(1:N));
You could put it all in a function if you really wanted, but it seems a bit simple:
pequiv = @(N,a,rho,h) a * sum(rho(1:N) .* h(1:N));

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Mathematics 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by