how to write this range in Matlab?

how do we write the following type of range in matlab:
∑_jϵN=m_nj
i.e. j lies in N.
Thanks.

댓글 수: 2

Azzi Abdelmalek
Azzi Abdelmalek 2016년 7월 21일
This is not clear
Walter Roberson
Walter Roberson 2016년 7월 21일
It looks to me as if it might be the sum over those j that are elements of (N = m) to (N = n), with the term to be summed being j ?

댓글을 달려면 로그인하십시오.

답변 (2개)

Walter Roberson
Walter Roberson 2016년 7월 21일

0 개 추천

I am going to guess that this is
sum(N(N >= m & N <= n))
Steven Lord
Steven Lord 2016년 7월 21일

0 개 추천

Use linear indexing.
% Generate sample data
x = (1:20).^2;
% Generate a set N over which to sum
N = randperm(20, 5)
% Compute the sum over the set N
sumXN = sum(x(N))
% Since the kth element of x is just k^2, check by summing N^2
% Use .^ to perform element-wise squaring
sumN2 = sum(N.^2)
sumXN and sumN2 should be the same.

카테고리

도움말 센터File Exchange에서 Variables에 대해 자세히 알아보기

태그

질문:

NMK
2016년 7월 21일

답변:

2016년 7월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by