Implementing summation in Matlab using Matlab Function

조회 수: 6 (최근 30일)
Abhishek Tiwari
Abhishek Tiwari 2021년 3월 25일
댓글: Abhishek Tiwari 2021년 3월 25일
I intend to implement the summation function. θ and are outputs from other simulink blocks whereas assume different values for each (i,j) combination starting from (0,0) to (4,4). I believe this can be done with use of Matalb Function block but I'm not really able to find a similar example. Can some please suggest how can this done?

답변 (1개)

David Hill
David Hill 2021년 3월 25일
I assume alpha is a 4x4 matrix, theta is a 1x4 array and lambda is a 1x4 array.
[theta,lambda]=meshgrid(theta,lambda);
output=sum(alpha.*theta.*lambda,'all');
  댓글 수: 1
Abhishek Tiwari
Abhishek Tiwari 2021년 3월 25일
Thank you David for your quick response. alpha is a 5x5 matrix (just to avoid any confusion please consider the range of i and j each from 1 to 5), and theta & lambda are the outputs of the other blocks in the simulation file. I don't really have the them in the form of an array.

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

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by