how to calculate this equation in matlab?

조회 수: 2 (최근 30일)
Kajal Agrawal
Kajal Agrawal 2023년 6월 13일
편집: Harsh Kumar 2023년 6월 15일
for i, n >3
can i calulate or generate any program for this equation.
  댓글 수: 6
Dyuman Joshi
Dyuman Joshi 2023년 6월 14일
Please show what you have attempted.
Kajal Agrawal
Kajal Agrawal 2023년 6월 14일
I think i have mistaken in loop..

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

채택된 답변

Harsh Kumar
Harsh Kumar 2023년 6월 15일
편집: Harsh Kumar 2023년 6월 15일
Hi Kajal ,
It is my understanding that you are interested in generating a program for the above mentioned mathematical equation.
You can use the concept of 'Nested Loop' to iterate over the two variables i.e, r and j for addition and multiplication respectively.
Please refer to the below code snippet for better understanding.
clc
clear
n=input('enter the value of n=')
i=input('enter the value of i=')
%variable to store product of terms
p=1;
for j=i:3
s=0; %sum variable
for r=1:j-2
s=s+(2^(j-2-r));
p=prod(p,2^(j-2)*(n)-(2^(j-1)-s));
end
end
vertices=(n*(n-1)*(n-2)*p)/2;
disp('vertices')
vertices

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품


릴리스

R2013a

Community Treasure Hunt

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

Start Hunting!

Translated by